feat: implementations.
This commit is contained in:
69
demo/Ursa.Demo/Pages/AnchorDemo.axaml
Normal file
69
demo/Ursa.Demo/Pages/AnchorDemo.axaml
Normal file
@@ -0,0 +1,69 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.AnchorDemo"
|
||||
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"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Grid ColumnDefinitions="*, Auto">
|
||||
<ScrollViewer
|
||||
Name="container"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Stretch">
|
||||
<StackPanel>
|
||||
<Rectangle
|
||||
Name="rectangle1"
|
||||
Height="300"
|
||||
HorizontalAlignment="Stretch"
|
||||
Fill="{DynamicResource SemiRed2}" />
|
||||
<Rectangle
|
||||
Name="rectangle2"
|
||||
Height="300"
|
||||
HorizontalAlignment="Stretch"
|
||||
Fill="{DynamicResource SemiPink1}" />
|
||||
<Rectangle
|
||||
Name="rectangle3"
|
||||
Height="300"
|
||||
HorizontalAlignment="Stretch"
|
||||
Fill="{DynamicResource SemiPurple1}" />
|
||||
<Rectangle
|
||||
Name="rectangle4"
|
||||
Height="300"
|
||||
HorizontalAlignment="Stretch"
|
||||
Fill="{DynamicResource SemiViolet1}" />
|
||||
<Rectangle
|
||||
Name="rectangle5"
|
||||
Height="300"
|
||||
HorizontalAlignment="Stretch"
|
||||
Fill="{DynamicResource SemiIndigo1}" />
|
||||
<Rectangle
|
||||
Name="rectangle6"
|
||||
Height="300"
|
||||
HorizontalAlignment="Stretch"
|
||||
Fill="{DynamicResource SemiBlue1}" />
|
||||
<Rectangle
|
||||
Name="rectangle7"
|
||||
Height="300"
|
||||
HorizontalAlignment="Stretch"
|
||||
Fill="{DynamicResource SemiLightBlue1}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<u:Anchor
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
Margin="24"
|
||||
TargetContainer="{Binding ElementName=container}">
|
||||
<u:AnchorItem Content="Rectangle 1" Target="{Binding #rectangle1}" />
|
||||
<u:AnchorItem Content="Rectangle 2" Target="{Binding #rectangle2}" />
|
||||
<u:AnchorItem Content="Rectangle 3" Target="{Binding #rectangle3}" />
|
||||
<u:AnchorItem Content="Rectangle 4" Target="{Binding #rectangle4}" />
|
||||
<u:AnchorItem Content="Rectangle 5" Target="{Binding #rectangle5}" />
|
||||
<u:AnchorItem Content="Rectangle 6" Target="{Binding #rectangle6}" />
|
||||
<u:AnchorItem Content="Rectangle 7" Target="{Binding #rectangle7}" />
|
||||
|
||||
</u:Anchor>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
13
demo/Ursa.Demo/Pages/AnchorDemo.axaml.cs
Normal file
13
demo/Ursa.Demo/Pages/AnchorDemo.axaml.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class AnchorDemo : UserControl
|
||||
{
|
||||
public AnchorDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
8
demo/Ursa.Demo/ViewModels/AnchorDemoViewModel.cs
Normal file
8
demo/Ursa.Demo/ViewModels/AnchorDemoViewModel.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public partial class AnchorDemoViewModel: ObservableObject
|
||||
{
|
||||
|
||||
}
|
||||
@@ -86,8 +86,9 @@ public partial class MainViewViewModel : ViewModelBase
|
||||
MenuKeys.MenuKeyToolBar => new ToolBarDemoViewModel(),
|
||||
MenuKeys.MenuKeyTreeComboBox => new TreeComboBoxDemoViewModel(),
|
||||
MenuKeys.MenuKeyTwoTonePathIcon => new TwoTonePathIconDemoViewModel(),
|
||||
MenuKeys.AspectRatioLayout => new AspectRatioLayoutDemoViewModel(),
|
||||
MenuKeys.PathPicker => new PathPickerDemoViewModel(),
|
||||
MenuKeys.MenuKeyAspectRatioLayout => new AspectRatioLayoutDemoViewModel(),
|
||||
MenuKeys.MenuKeyPathPicker => new PathPickerDemoViewModel(),
|
||||
MenuKeys.MenuKeyAnchor => new AnchorDemoViewModel(),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(s), s, null)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class MenuViewModel : ViewModelBase
|
||||
new() { MenuHeader = "MultiComboBox", Key = MenuKeys.MenuKeyMultiComboBox },
|
||||
new() { MenuHeader = "Numeric UpDown", Key = MenuKeys.MenuKeyNumericUpDown },
|
||||
new() { MenuHeader = "NumPad", Key = MenuKeys.MenuKeyNumPad },
|
||||
new() { MenuHeader = "PathPicker", Key = MenuKeys.PathPicker, Status = "New" },
|
||||
new() { MenuHeader = "PathPicker", Key = MenuKeys.MenuKeyPathPicker, Status = "New" },
|
||||
new() { MenuHeader = "PinCode", Key = MenuKeys.MenuKeyPinCode },
|
||||
new() { MenuHeader = "RangeSlider", Key = MenuKeys.MenuKeyRangeSlider },
|
||||
new() { MenuHeader = "Rating", Key = MenuKeys.MenuKeyRating },
|
||||
@@ -67,6 +67,7 @@ public class MenuViewModel : ViewModelBase
|
||||
{
|
||||
MenuHeader = "Navigation & Menus", Children = new ObservableCollection<MenuItemViewModel>
|
||||
{
|
||||
new() { MenuHeader = "Anchor", Key = MenuKeys.MenuKeyAnchor, Status = "New" },
|
||||
new() { MenuHeader = "Breadcrumb", Key = MenuKeys.MenuKeyBreadcrumb, Status = "Updated" },
|
||||
new() { MenuHeader = "Nav Menu", Key = MenuKeys.MenuKeyNavMenu, Status = "Updated" },
|
||||
new() { MenuHeader = "Pagination", Key = MenuKeys.MenuKeyPagination },
|
||||
@@ -78,7 +79,7 @@ public class MenuViewModel : ViewModelBase
|
||||
MenuHeader = "Layout & Display",
|
||||
Children = new ObservableCollection<MenuItemViewModel>
|
||||
{
|
||||
new() { MenuHeader = "AspectRatioLayout", Key = MenuKeys.AspectRatioLayout },
|
||||
new() { MenuHeader = "AspectRatioLayout", Key = MenuKeys.MenuKeyAspectRatioLayout },
|
||||
new() { MenuHeader = "Avatar", Key = MenuKeys.MenuKeyAvatar, Status = "WIP" },
|
||||
new() { MenuHeader = "Badge", Key = MenuKeys.MenuKeyBadge },
|
||||
new() { MenuHeader = "Banner", Key = MenuKeys.MenuKeyBanner, Status = "Updated" },
|
||||
@@ -154,6 +155,7 @@ public static class MenuKeys
|
||||
public const string MenuKeyToolBar = "ToolBar";
|
||||
public const string MenuKeyTreeComboBox = "TreeComboBox";
|
||||
public const string MenuKeyTwoTonePathIcon = "TwoTonePathIcon";
|
||||
public const string AspectRatioLayout = "AspectRatioLayout";
|
||||
public const string PathPicker = "PathPicker";
|
||||
public const string MenuKeyAspectRatioLayout = "AspectRatioLayout";
|
||||
public const string MenuKeyPathPicker = "PathPicker";
|
||||
public const string MenuKeyAnchor = "Anchor";
|
||||
}
|
||||
Reference in New Issue
Block a user