feat: ListBox demo.
This commit is contained in:
parent
a1e17b0e19
commit
430a7e56ca
@ -8,40 +8,103 @@
|
||||
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}">
|
||||
<Grid ColumnDefinitions="*,*">
|
||||
<HeaderedContentControl
|
||||
Grid.Column="0"
|
||||
Theme="{StaticResource GroupBox}"
|
||||
Header="Default">
|
||||
<ScrollViewer>
|
||||
<StackPanel Spacing="20">
|
||||
<ListBox ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
||||
<ListBox IsEnabled="False">
|
||||
<ListBoxItem IsSelected="True">Avalonia</ListBoxItem>
|
||||
<ListBoxItem>WPF</ListBoxItem>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl
|
||||
Grid.Column="1"
|
||||
Theme="{DynamicResource GroupBox}"
|
||||
Header="RadioGroupListBox">
|
||||
<StackPanel Spacing="20">
|
||||
<ListBox
|
||||
Theme="{DynamicResource RadioGroupListBox}"
|
||||
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
||||
<ListBox Theme="{DynamicResource RadioGroupListBox}" IsEnabled="False">
|
||||
<ListBoxItem IsSelected="True">Avalonia</ListBoxItem>
|
||||
<ListBoxItem>WPF</ListBoxItem>
|
||||
</ListBox>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border HorizontalAlignment="Left" Theme="{StaticResource RadioButtonGroupBorder}">
|
||||
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}">
|
||||
<ListBoxItem Classes="Small" IsSelected="True">Small 1</ListBoxItem>
|
||||
<ListBoxItem Classes="Small">Small 2</ListBoxItem>
|
||||
</ListBox>
|
||||
</Border>
|
||||
<Border
|
||||
Margin="8,0"
|
||||
HorizontalAlignment="Left"
|
||||
Theme="{StaticResource RadioButtonGroupBorder}">
|
||||
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}" IsEnabled="False">
|
||||
<ListBoxItem Classes="Small" IsSelected="True">Small 1</ListBoxItem>
|
||||
<ListBoxItem Classes="Small">Small 2</ListBoxItem>
|
||||
</ListBox>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border HorizontalAlignment="Left" Theme="{StaticResource RadioButtonGroupBorder}">
|
||||
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}">
|
||||
<ListBoxItem IsSelected="True">Default 1</ListBoxItem>
|
||||
<ListBoxItem>Default 2</ListBoxItem>
|
||||
</ListBox>
|
||||
</Border>
|
||||
<Border
|
||||
Margin="8,0"
|
||||
HorizontalAlignment="Left"
|
||||
Theme="{StaticResource RadioButtonGroupBorder}">
|
||||
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}" IsEnabled="False">
|
||||
<ListBoxItem IsSelected="True">Default 1</ListBoxItem>
|
||||
<ListBoxItem>Default 2</ListBoxItem>
|
||||
</ListBox>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border HorizontalAlignment="Left" Theme="{StaticResource RadioButtonGroupBorder}">
|
||||
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}">
|
||||
<ListBoxItem Classes="Large" IsSelected="True">Small 1</ListBoxItem>
|
||||
<ListBoxItem Classes="Large">Small 2</ListBoxItem>
|
||||
</ListBox>
|
||||
</Border>
|
||||
<Border
|
||||
Margin="8,0"
|
||||
HorizontalAlignment="Left"
|
||||
Theme="{StaticResource RadioButtonGroupBorder}">
|
||||
<ListBox Theme="{DynamicResource ButtonRadioGroupListBox}" IsEnabled="False">
|
||||
<ListBoxItem Classes="Large" IsSelected="True">Small 1</ListBoxItem>
|
||||
<ListBoxItem Classes="Large">Small 2</ListBoxItem>
|
||||
</ListBox>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<ListBox Theme="{DynamicResource CardRadioGroupListBox}"
|
||||
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
||||
<ListBox Theme="{DynamicResource CardRadioGroupListBox}" IsEnabled="False">
|
||||
<ListBoxItem IsSelected="True">Avalonia</ListBoxItem>
|
||||
<ListBoxItem>WPF</ListBoxItem>
|
||||
</ListBox>
|
||||
|
||||
<ListBox Theme="{DynamicResource PureCardRadioGroupListBox}"
|
||||
ItemsSource="{Binding $parent[local:ListBoxDemo].Items}" />
|
||||
<ListBox Theme="{DynamicResource PureCardRadioGroupListBox}" IsEnabled="False">
|
||||
<ListBoxItem IsSelected="True">Avalonia</ListBoxItem>
|
||||
<ListBoxItem>WPF</ListBoxItem>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</HeaderedContentControl>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
@ -11,18 +11,5 @@ public partial class ListBoxDemo : UserControl
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public IEnumerable Items { get; set; } = new List<Panda>
|
||||
{
|
||||
new() { Name = "Ding", IsAvailable = true },
|
||||
new() { Name = "Otter", IsAvailable = true },
|
||||
new() { Name = "Husky", IsAvailable = false },
|
||||
new() { Name = "Mr.17", IsAvailable = true },
|
||||
new() { Name = "Cass", IsAvailable = true },
|
||||
};
|
||||
}
|
||||
|
||||
internal record Panda
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool IsAvailable { get; set; }
|
||||
public IEnumerable Items { get; set; } = new List<string> { "Ding", "Otter", "Husky", "Mr.17", "Cass", };
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user