Files
Ursa.Avalonia/src/Ursa.Themes.Semi/Controls/MultiComboBox.axaml
2024-03-24 23:05:44 +08:00

33 lines
1.6 KiB
XML

<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<!-- Add Resources Here -->
<ControlTheme TargetType="u:MultiComboBox" x:Key="{x:Type u:MultiComboBox}">
<Setter Property="Focusable" Value="True"></Setter>
<Setter Property="Template">
<ControlTemplate TargetType="u:MultiComboBox">
<Panel>
<ToggleButton Name="button">
<ItemsControl ItemsSource="{TemplateBinding SelectedItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</ToggleButton>
<Popup PlacementTarget="button" IsOpen="{Binding #button.IsChecked}">
<ListBox Name="{x:Static u:MultiComboBox.PART_ListBox}" SelectionMode="Multiple" ItemsSource="{TemplateBinding ItemsSource}" SelectedItems="{TemplateBinding SelectedItems}">
</ListBox>
</Popup>
</Panel>
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme TargetType="u:MultiComboBoxItem" x:Key="{x:Type u:MultiComboBoxItem}">
<Setter Property="Focusable" Value="True"></Setter>
</ControlTheme>
</ResourceDictionary>