Merge pull request #393 from irihitech/selectable
Introduce IsSelectable for TreeComboBoxItem.
This commit is contained in:
@@ -217,6 +217,7 @@
|
||||
<Setter Property="Background" Value="{DynamicResource TreeViewItemDefaultBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemDefaultForeground}" />
|
||||
<Setter Property="CornerRadius" Value="3" />
|
||||
<Setter Property="MinHeight" Value="32"></Setter>
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="u:TreeComboBoxItem">
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -33,6 +33,15 @@ public class TreeComboBoxItem: HeaderedItemsControl, ISelectable
|
||||
set => SetValue(IsExpandedProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsSelectableProperty = AvaloniaProperty.Register<TreeComboBoxItem, bool>(
|
||||
nameof(IsSelectable), true);
|
||||
|
||||
public bool IsSelectable
|
||||
{
|
||||
get => GetValue(IsSelectableProperty);
|
||||
set => SetValue(IsSelectableProperty, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static readonly DirectProperty<TreeComboBoxItem, int> LevelProperty = AvaloniaProperty.RegisterDirect<TreeComboBoxItem, int>(
|
||||
|
||||
Reference in New Issue
Block a user