Files
Ursa.Avalonia/demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml
2024-09-06 23:57:24 +08:00

48 lines
2.1 KiB
XML

<UserControl
x:Class="Ursa.Demo.Pages.MultiComboBoxDemo"
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:u="https://irihi.tech/ursa"
xmlns:vm="using:Ursa.Demo.ViewModels"
d:DesignHeight="450"
d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="vm:MultiComboBoxDemoViewModel"
mc:Ignorable="d">
<StackPanel Orientation="Horizontal">
<u:MultiComboBox
Watermark="Please Select"
Width="300"
MaxHeight="200"
SelectedItems="{Binding SelectedItems}"
ItemsSource="{Binding Items}" >
</u:MultiComboBox>
<u:MultiComboBox
Name="combo"
Watermark="Please Select"
Width="300"
InnerLeftContent="Left"
InnerRightContent="Right"
Classes="ClearButton"
MaxHeight="200"
SelectedItems="{Binding SelectedItems}"
ItemsSource="{Binding Items}" >
<u:MultiComboBox.PopupInnerTopContent>
<StackPanel Margin="0" Orientation="Horizontal">
<Button Theme="{DynamicResource BorderlessButton}" Content="Select All" Command="{Binding SelectAllCommand}"/>
<Button Theme="{DynamicResource BorderlessButton}" Content="Unselect All" Command="{Binding ClearAllCommand}"/>
<Button Theme="{DynamicResource BorderlessButton}" Content="Inverse" Command="{Binding InvertSelectionCommand}"/>
</StackPanel>
</u:MultiComboBox.PopupInnerTopContent>
<u:MultiComboBox.ContextFlyout>
<MenuFlyout>
<MenuItem Header="Select All" Command="{Binding SelectAllCommand}"/>
</MenuFlyout>
</u:MultiComboBox.ContextFlyout>
</u:MultiComboBox>
<ListBox ItemsSource="{Binding SelectedItems}" />
</StackPanel>
</UserControl>