33 lines
1.4 KiB
XML
33 lines
1.4 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>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</UserControl> |