diff --git a/demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml b/demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml
index e204bff..e46b9d1 100644
--- a/demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml
+++ b/demo/Ursa.Demo/Pages/TreeComboBoxDemo.axaml
@@ -52,6 +52,11 @@
PopupInnerTopContent="Top"
PopupInnerBottomContent="Bottom"
ItemsSource="{Binding Items}">
+
+
+
diff --git a/demo/Ursa.Demo/ViewModels/TreeComboBoxDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/TreeComboBoxDemoViewModel.cs
index 998bb41..bca68e5 100644
--- a/demo/Ursa.Demo/ViewModels/TreeComboBoxDemoViewModel.cs
+++ b/demo/Ursa.Demo/ViewModels/TreeComboBoxDemoViewModel.cs
@@ -19,7 +19,8 @@ public partial class TreeComboBoxDemoViewModel: ObservableObject
{
new TreeComboBoxItemViewModel()
{
- ItemName = "Item 1-1",
+ ItemName = "Item 1-1 (Not selectable)",
+ IsSelectable = false,
Children = new List()
{
new TreeComboBoxItemViewModel()
@@ -45,7 +46,8 @@ public partial class TreeComboBoxDemoViewModel: ObservableObject
{
new TreeComboBoxItemViewModel()
{
- ItemName = "Item 2-1"
+ ItemName = "Item 2-1 (Not selectable)",
+ IsSelectable = false,
},
new TreeComboBoxItemViewModel()
{
@@ -64,5 +66,6 @@ public partial class TreeComboBoxDemoViewModel: ObservableObject
public partial class TreeComboBoxItemViewModel : ObservableObject
{
[ObservableProperty] private string? _itemName;
+ [ObservableProperty] private bool _isSelectable = true;
public List Children { get; set; } = new ();
}
\ No newline at end of file
diff --git a/src/Ursa.Themes.Semi/Controls/TreeComboBox.axaml b/src/Ursa.Themes.Semi/Controls/TreeComboBox.axaml
index db9b61b..d3f5f71 100644
--- a/src/Ursa.Themes.Semi/Controls/TreeComboBox.axaml
+++ b/src/Ursa.Themes.Semi/Controls/TreeComboBox.axaml
@@ -217,6 +217,7 @@
+
diff --git a/src/Ursa/Controls/ComboBox/TreeComboBox.cs b/src/Ursa/Controls/ComboBox/TreeComboBox.cs
index e88d55e..a039893 100644
--- a/src/Ursa/Controls/ComboBox/TreeComboBox.cs
+++ b/src/Ursa/Controls/ComboBox/TreeComboBox.cs
@@ -198,7 +198,7 @@ public class TreeComboBox: ItemsControl, IClearControl, IInnerContentControl, IP
if (_popup is not null && _popup.IsOpen && _popup.IsInsidePopup(source))
{
var container = GetContainerFromEventSource(source);
- if (container is null) return;
+ if (container is null || !container.IsSelectable) return;
var item = TreeItemFromContainer(container);
if (item is null) return;
if (SelectedItem is not null)
diff --git a/src/Ursa/Controls/ComboBox/TreeComboBoxItem.cs b/src/Ursa/Controls/ComboBox/TreeComboBoxItem.cs
index fae2526..6da7949 100644
--- a/src/Ursa/Controls/ComboBox/TreeComboBoxItem.cs
+++ b/src/Ursa/Controls/ComboBox/TreeComboBoxItem.cs
@@ -33,6 +33,15 @@ public class TreeComboBoxItem: HeaderedItemsControl, ISelectable
set => SetValue(IsExpandedProperty, value);
}
+ public static readonly StyledProperty IsSelectableProperty = AvaloniaProperty.Register(
+ nameof(IsSelectable), true);
+
+ public bool IsSelectable
+ {
+ get => GetValue(IsSelectableProperty);
+ set => SetValue(IsSelectableProperty, value);
+ }
+
public static readonly DirectProperty LevelProperty = AvaloniaProperty.RegisterDirect(