47 lines
2.2 KiB
XML

<UserControl
x:Class="Semi.Avalonia.Demo.Pages.ListBoxDemo"
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:local="clr-namespace:Semi.Avalonia.Demo.Pages"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<DataTemplate x:Key="PandaTemplate" DataType="local:Panda">
<TextBlock Text="{Binding Name}" />
</DataTemplate>
<ControlTheme
x:Key="PandaControlTheme"
BasedOn="{StaticResource RadioGroupListBoxItem}"
TargetType="ListBoxItem">
<Setter Property="IsEnabled" Value="{Binding IsAvailable}" />
</ControlTheme>
</UserControl.Resources>
<ScrollViewer>
<StackPanel>
<ListBox ItemsSource="{Binding $parent[local:ListBoxDemo].Items}"
ItemTemplate="{StaticResource PandaTemplate}" />
<ListBox Theme="{DynamicResource RadioGroupListBox}"
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}"
ItemTemplate="{StaticResource PandaTemplate}"
ItemContainerTheme="{StaticResource PandaControlTheme}">
</ListBox>
<Border HorizontalAlignment="Left" Theme="{StaticResource RadioButtonGroupBorder}">
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}"
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}"
ItemTemplate="{StaticResource PandaTemplate}">
</ListBox>
</Border>
<ListBox Theme="{DynamicResource CardRadioGroupListBox}"
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}"
ItemTemplate="{StaticResource PandaTemplate}">
</ListBox>
<ListBox Theme="{DynamicResource PureCardRadioGroupListBox}"
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}"
ItemTemplate="{StaticResource PandaTemplate}">
</ListBox>
</StackPanel>
</ScrollViewer>
</UserControl>