Browse Source
- Make the list box fill available space - `SelectionMode` is a `[Flags]` enum so a combo box didn't make sense - Add check for `AutoScrollToSelectedItem`pull/4659/head
3 changed files with 63 additions and 43 deletions
@ -1,35 +1,25 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
x:Class="ControlCatalog.Pages.ListBoxPage"> |
|||
<StackPanel Orientation="Vertical" Spacing="4"> |
|||
<TextBlock Classes="h1">ListBox</TextBlock> |
|||
<TextBlock Classes="h2">Hosts a collection of ListBoxItem.</TextBlock> |
|||
|
|||
<StackPanel Orientation="Horizontal" |
|||
Margin="0,16,0,0" |
|||
HorizontalAlignment="Center" |
|||
Spacing="16"> |
|||
<StackPanel Orientation="Vertical" Spacing="8"> |
|||
<ListBox Items="{Binding Items}" |
|||
Selection="{Binding Selection}" |
|||
AutoScrollToSelectedItem="True" |
|||
SelectionMode="{Binding SelectionMode}" |
|||
Width="250" |
|||
Height="350"/> |
|||
|
|||
<Button Command="{Binding AddItemCommand}">Add</Button> |
|||
|
|||
<Button Command="{Binding RemoveItemCommand}">Remove</Button> |
|||
|
|||
<Button Command="{Binding SelectRandomItemCommand}">Select Random Item</Button> |
|||
|
|||
<ComboBox SelectedIndex="{Binding SelectionMode, Mode=TwoWay}"> |
|||
<ComboBoxItem>Single</ComboBoxItem> |
|||
<ComboBoxItem>Multiple</ComboBoxItem> |
|||
<ComboBoxItem>Toggle</ComboBoxItem> |
|||
<ComboBoxItem>AlwaysSelected</ComboBoxItem> |
|||
</ComboBox> |
|||
</StackPanel> |
|||
<DockPanel> |
|||
<StackPanel DockPanel.Dock="Top" Margin="4"> |
|||
<TextBlock Classes="h1">ListBox</TextBlock> |
|||
<TextBlock Classes="h2">Hosts a collection of ListBoxItem.</TextBlock> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
<StackPanel DockPanel.Dock="Right" Margin="4"> |
|||
<CheckBox IsChecked="{Binding Multiple}">Multiple</CheckBox> |
|||
<CheckBox IsChecked="{Binding Toggle}">Toggle</CheckBox> |
|||
<CheckBox IsChecked="{Binding AlwaysSelected}">AlwaysSelected</CheckBox> |
|||
<CheckBox IsChecked="{Binding AutoScrollToSelectedItem}">AutoScrollToSelectedItem</CheckBox> |
|||
</StackPanel> |
|||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Margin="4"> |
|||
<Button Command="{Binding AddItemCommand}">Add</Button> |
|||
<Button Command="{Binding RemoveItemCommand}">Remove</Button> |
|||
<Button Command="{Binding SelectRandomItemCommand}">Select Random Item</Button> |
|||
</StackPanel> |
|||
<ListBox Items="{Binding Items}" |
|||
Selection="{Binding Selection}" |
|||
AutoScrollToSelectedItem="{Binding AutoScrollToSelectedItem}" |
|||
SelectionMode="{Binding SelectionMode}"/> |
|||
</DockPanel> |
|||
</UserControl> |
|||
|
|||
Loading…
Reference in new issue