Merge pull request #588 from irihitech/selection

Fix various issues for SelectionList
This commit is contained in:
Dong Bin
2025-02-27 15:54:32 +08:00
committed by GitHub
3 changed files with 52 additions and 37 deletions

View File

@@ -12,10 +12,14 @@
x:DataType="vm:SelectionListDemoViewModel"
mc:Ignorable="d">
<StackPanel HorizontalAlignment="Left">
<u:SelectionList ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
<u:SelectionList
Width="600"
HorizontalAlignment="Center"
ItemsSource="{Binding Items}"
SelectedItem="{Binding SelectedItem}">
<u:SelectionList.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" />
</ItemsPanelTemplate>
</u:SelectionList.ItemsPanel>
</u:SelectionList>
@@ -36,9 +40,9 @@
<DataTemplate>
<Panel Height="40">
<TextBlock
Classes.Active="{Binding $parent[u:SelectionListItem].IsSelected, Mode=OneWay}"
Margin="8,0"
VerticalAlignment="Center"
Classes.Active="{Binding $parent[u:SelectionListItem].IsSelected, Mode=OneWay}"
Text="{Binding}">
<TextBlock.Styles>
<Style Selector="TextBlock.Active">
@@ -50,6 +54,14 @@
</DataTemplate>
</u:SelectionList.ItemTemplate>
</u:SelectionList>
<Button Command="{Binding Clear}">Clear</Button>
<SplitButton Content="Button With Selection">
<SplitButton.Flyout>
<Flyout>
<u:SelectionList ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" />
</Flyout>
</SplitButton.Flyout>
</SplitButton>
<Button Margin="0 12" Command="{Binding Clear}">Clear</Button>
</StackPanel>
</UserControl>