-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #480 from WCKYWCKF/new-control
Add a new control AspectRatioLayout
- Loading branch information
Showing
9 changed files
with
444 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:u="https://irihi.tech/ursa" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="Ursa.Demo.Pages.AspectRatioLayoutDemo"> | ||
<Grid | ||
RowDefinitions="Auto,*"> | ||
<StackPanel | ||
Grid.Row="0"> | ||
<u:NumericDoubleUpDown InnerLeftContent="AspectRatioTolerance" | ||
Value="{Binding #AspectRatioLayout.AspectRatioTolerance}"> | ||
</u:NumericDoubleUpDown> | ||
<TextBlock Text="{Binding #AspectRatioLayout.AspectRatioValue,StringFormat='AspectRatioValue: {0}'}"></TextBlock> | ||
</StackPanel> | ||
|
||
<u:AspectRatioLayout Name="AspectRatioLayout" Grid.Row="1" | ||
BorderThickness="1" | ||
BorderBrush="Red" | ||
Margin="2" | ||
CornerRadius="10"> | ||
<u:AspectRatioLayoutItem AcceptAspectRatioMode="HorizontalRectangle"> | ||
<Button>HorizontalRectangle ControlLayout</Button> | ||
</u:AspectRatioLayoutItem> | ||
<u:AspectRatioLayoutItem AcceptAspectRatioMode="VerticalRectangle"> | ||
<Button>VerticalRectangle ControlLayout</Button> | ||
</u:AspectRatioLayoutItem> | ||
<u:AspectRatioLayoutItem AcceptAspectRatioMode="Square"> | ||
<Button>Square ControlLayout</Button> | ||
</u:AspectRatioLayoutItem> | ||
<u:AspectRatioLayoutItem StartAspectRatioValue="2" EndAspectRatioValue="2.2"> | ||
<TextBlock | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center"> | ||
<Run Text="{Binding $parent[u:AspectRatioLayoutItem].StartAspectRatioValue,StringFormat='StartAspectRatioValue {0}'}"></Run> | ||
<LineBreak></LineBreak> | ||
<Run Text="{Binding $parent[u:AspectRatioLayoutItem].EndAspectRatioValue,StringFormat='EndAspectRatioValue {0}'}"></Run> | ||
</TextBlock> | ||
</u:AspectRatioLayoutItem> | ||
<u:AspectRatioLayoutItem StartAspectRatioValue="2" EndAspectRatioValue="2.4"> | ||
<TextBlock | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center"> | ||
<Run Text="{Binding $parent[u:AspectRatioLayoutItem].StartAspectRatioValue,StringFormat='StartAspectRatioValue {0}'}"></Run> | ||
<LineBreak></LineBreak> | ||
<Run Text="{Binding $parent[u:AspectRatioLayoutItem].EndAspectRatioValue,StringFormat='EndAspectRatioValue {0}'}"></Run> | ||
</TextBlock> | ||
</u:AspectRatioLayoutItem> | ||
<u:AspectRatioLayoutItem StartAspectRatioValue="2" EndAspectRatioValue="2.6"> | ||
<TextBlock | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center"> | ||
<Run Text="{Binding $parent[u:AspectRatioLayoutItem].StartAspectRatioValue,StringFormat='StartAspectRatioValue {0}'}"></Run> | ||
<LineBreak></LineBreak> | ||
<Run Text="{Binding $parent[u:AspectRatioLayoutItem].EndAspectRatioValue,StringFormat='EndAspectRatioValue {0}'}"></Run> | ||
</TextBlock> | ||
</u:AspectRatioLayoutItem> | ||
<u:AspectRatioLayoutItem StartAspectRatioValue="2" EndAspectRatioValue="2.8"> | ||
<TextBlock | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center"> | ||
<Run Text="{Binding $parent[u:AspectRatioLayoutItem].StartAspectRatioValue,StringFormat='StartAspectRatioValue {0}'}"></Run> | ||
<LineBreak></LineBreak> | ||
<Run Text="{Binding $parent[u:AspectRatioLayoutItem].EndAspectRatioValue,StringFormat='EndAspectRatioValue {0}'}"></Run> | ||
</TextBlock> | ||
</u:AspectRatioLayoutItem> | ||
<u:AspectRatioLayoutItem StartAspectRatioValue="1.3" EndAspectRatioValue="1.5"> | ||
<TextBlock | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center"> | ||
<Run Text="{Binding $parent[u:AspectRatioLayoutItem].StartAspectRatioValue,StringFormat='StartAspectRatioValue {0}'}"></Run> | ||
<LineBreak></LineBreak> | ||
<Run Text="{Binding $parent[u:AspectRatioLayoutItem].EndAspectRatioValue,StringFormat='EndAspectRatioValue {0}'}"></Run> | ||
</TextBlock> | ||
</u:AspectRatioLayoutItem> | ||
</u:AspectRatioLayout> | ||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
|
||
namespace Ursa.Demo.Pages; | ||
|
||
public partial class AspectRatioLayoutDemo : UserControl | ||
{ | ||
public AspectRatioLayoutDemo() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace Ursa.Demo.ViewModels; | ||
|
||
public class AspectRatioLayoutDemoViewModel : ViewModelBase | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
"sdk": { | ||
"version": "8.0.0", | ||
"rollForward": "latestMajor", | ||
"allowPrerelease": false | ||
"allowPrerelease": true | ||
} | ||
} |
Oops, something went wrong.