feat: enhance Anchor styles.

This commit is contained in:
Zhang Dian
2025-07-10 19:07:59 +08:00
parent d470488c76
commit b304d585bd
10 changed files with 82 additions and 20 deletions

View File

@@ -141,6 +141,27 @@
Background="{DynamicResource SemiPurple1}">
<TextBlock Text="Border 3-2" />
</Border>
<Border
Height="300"
HorizontalAlignment="Stretch"
u:Anchor.Id="anchor3-2-1"
Background="{DynamicResource SemiCyan1}">
<TextBlock Text="Border 3-2-1" />
</Border>
<Border
Height="300"
HorizontalAlignment="Stretch"
u:Anchor.Id="anchor3-2-2"
Background="{DynamicResource SemiCyan1}">
<TextBlock Text="Border 3-2-2" />
</Border>
<Border
Height="300"
HorizontalAlignment="Stretch"
u:Anchor.Id="anchor3-2-3"
Background="{DynamicResource SemiCyan1}">
<TextBlock Text="Border 3-2-3" />
</Border>
<Border
Height="300"
HorizontalAlignment="Stretch"
@@ -180,6 +201,7 @@
</ScrollViewer>
<u:Anchor
Grid.Column="1"
Classes="Tertiary"
Width="200"
Margin="24"
ItemsSource="{Binding AnchorItems}"

View File

@@ -4,7 +4,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
namespace Ursa.Demo.ViewModels;
public partial class AnchorDemoViewModel: ObservableObject
public partial class AnchorDemoViewModel : ObservableObject
{
public List<AnchorItemViewModel> AnchorItems { get; } = new()
{
@@ -16,7 +16,16 @@ public partial class AnchorDemoViewModel: ObservableObject
Children =
[
new AnchorItemViewModel() { AnchorId = "anchor3-1", Header = "Anchor 3.1" },
new AnchorItemViewModel() { AnchorId = "anchor3-2", Header = "Anchor 3.2" },
new AnchorItemViewModel()
{
AnchorId = "anchor3-2", Header = "Anchor 3.2",
Children =
[
new AnchorItemViewModel() { AnchorId = "anchor3-2-1", Header = "Anchor 3.2.1" },
new AnchorItemViewModel() { AnchorId = "anchor3-2-2", Header = "Anchor 3.2.2" },
new AnchorItemViewModel() { AnchorId = "anchor3-2-3", Header = "Anchor 3.2.3" }
]
},
new AnchorItemViewModel() { AnchorId = "anchor3-3", Header = "Anchor 3.3" }
]
},
@@ -27,7 +36,7 @@ public partial class AnchorDemoViewModel: ObservableObject
};
}
public partial class AnchorItemViewModel: ObservableObject
public partial class AnchorItemViewModel : ObservableObject
{
[ObservableProperty] private string? _anchorId;
[ObservableProperty] private string? _header;