feat: add a simple template.

This commit is contained in:
rabbitism
2024-03-24 16:45:29 +08:00
parent d271623a66
commit d91a17474c
3 changed files with 24 additions and 3 deletions

View File

@@ -4,6 +4,26 @@
<!-- 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 SelectionMode="Multiple" ItemsSource="{TemplateBinding ItemsSource}" SelectedItems="{TemplateBinding SelectedItems}">
</ListBox>
</Popup>
</Panel>
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme TargetType="u:MultiComboBoxItem" x:Key="{x:Type u:MultiComboBoxItem}">