feat: add a simple template.
This commit is contained in:
@@ -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}">
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<ResourceInclude Source="KeyGestureInput.axaml" />
|
||||
<ResourceInclude Source="Loading.axaml" />
|
||||
<ResourceInclude Source="MessageBox.axaml" />
|
||||
<ResourceInclude Source="MultiComboBox.axaml" />
|
||||
<ResourceInclude Source="NavMenu.axaml" />
|
||||
<ResourceInclude Source="NumericUpDown.axaml" />
|
||||
<ResourceInclude Source="NumPad.axaml" />
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
@@ -8,8 +10,6 @@ namespace Ursa.Controls;
|
||||
|
||||
public class MultiComboBox: SelectingItemsControl
|
||||
{
|
||||
private ComboBox _box;
|
||||
|
||||
private static ITemplate<Panel?> _defaultPanel = new FuncTemplate<Panel?>(() => new VirtualizingStackPanel());
|
||||
|
||||
public static readonly StyledProperty<bool> IsDropDownOpenProperty =
|
||||
|
||||
Reference in New Issue
Block a user