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