diff --git a/demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml b/demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml
index 6687870..c325754 100644
--- a/demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml
+++ b/demo/Ursa.Demo/Pages/MultiComboBoxDemo.axaml
@@ -12,6 +12,12 @@
x:DataType="vm:MultiComboBoxDemoViewModel"
mc:Ignorable="d">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/demo/Ursa.Demo/ViewModels/MultiComboBoxDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/MultiComboBoxDemoViewModel.cs
index 277332d..ad318de 100644
--- a/demo/Ursa.Demo/ViewModels/MultiComboBoxDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/MultiComboBoxDemoViewModel.cs
@@ -1,12 +1,44 @@
-using System.Collections.ObjectModel;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Windows.Input;
using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
namespace Ursa.Demo.ViewModels;
public class MultiComboBoxDemoViewModel: ObservableObject
{
public ObservableCollection Items { get; set; }
+
+ public ObservableCollection SelectedItems { get; set; }
+ public ICommand SelectAllCommand => new RelayCommand(() =>
+ {
+ SelectedItems.Clear();
+ foreach (var item in Items)
+ {
+ SelectedItems.Add(item);
+ }
+ });
+
+ public ICommand ClearAllCommand => new RelayCommand(() =>
+ {
+ SelectedItems.Clear();
+ });
+
+ public ICommand InvertSelectionCommand => new RelayCommand(() =>
+ {
+ var selectedItems = new List(SelectedItems);
+ SelectedItems.Clear();
+ foreach (var item in Items)
+ {
+ if (!selectedItems.Contains(item))
+ {
+ SelectedItems.Add(item);
+ }
+ }
+ });
+
public MultiComboBoxDemoViewModel()
{
Items = new ObservableCollection()
@@ -47,5 +79,6 @@ public class MultiComboBoxDemoViewModel: ObservableObject
"Pennsylvania",
"Rhode Island",
};
+ SelectedItems = new ObservableCollection();
}
}
\ No newline at end of file
diff --git a/src/Ursa.Themes.Semi/Controls/MultiComboBox.axaml b/src/Ursa.Themes.Semi/Controls/MultiComboBox.axaml
index 9882920..9514d0e 100644
--- a/src/Ursa.Themes.Semi/Controls/MultiComboBox.axaml
+++ b/src/Ursa.Themes.Semi/Controls/MultiComboBox.axaml
@@ -51,6 +51,7 @@
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{TemplateBinding Foreground}"
+ IsHitTestVisible="False"
IsVisible="False"
Opacity="0.3"
Text="{TemplateBinding Watermark}" />
@@ -104,7 +105,7 @@
-
-
-
+
+
+
+
+
+
+
@@ -143,12 +148,12 @@
diff --git a/src/Ursa/Controls/ComboBox/MultiComboBox.cs b/src/Ursa/Controls/ComboBox/MultiComboBox.cs
index 0a10568..d9c2918 100644
--- a/src/Ursa/Controls/ComboBox/MultiComboBox.cs
+++ b/src/Ursa/Controls/ComboBox/MultiComboBox.cs
@@ -8,128 +8,159 @@ using Avalonia.Controls.Primitives;
using Avalonia.Controls.Templates;
using Avalonia.Input;
using Avalonia.Interactivity;
-using Irihi.Avalonia.Shared.Helpers;
using Irihi.Avalonia.Shared.Contracts;
+using Irihi.Avalonia.Shared.Helpers;
namespace Ursa.Controls;
[TemplatePart(PART_BackgroundBorder, typeof(Border))]
[PseudoClasses(PC_DropDownOpen, PC_Empty)]
-public class MultiComboBox: SelectingItemsControl, IInnerContentControl
+public class MultiComboBox : SelectingItemsControl, IInnerContentControl, IPopupInnerContent
{
public const string PART_BackgroundBorder = "PART_BackgroundBorder";
public const string PC_DropDownOpen = ":dropdownopen";
public const string PC_Empty = ":selection-empty";
-
- private Border? _rootBorder;
-
- private static ITemplate _defaultPanel = new FuncTemplate(() => new VirtualizingStackPanel());
+
+ private static readonly ITemplate _defaultPanel =
+ new FuncTemplate(() => new VirtualizingStackPanel());
public static readonly StyledProperty IsDropDownOpenProperty =
ComboBox.IsDropDownOpenProperty.AddOwner();
-
+
+ public static readonly StyledProperty MaxDropdownHeightProperty =
+ AvaloniaProperty.Register(
+ nameof(MaxDropdownHeight));
+
+ public static readonly StyledProperty MaxSelectionBoxHeightProperty =
+ AvaloniaProperty.Register(
+ nameof(MaxSelectionBoxHeight));
+
+ public new static readonly StyledProperty SelectedItemsProperty =
+ AvaloniaProperty.Register(
+ nameof(SelectedItems));
+
+ public static readonly StyledProperty