Skip to content

Commit ecacb44

Browse files
authored
Adding the ability to disable the expand on double click behavior (#3399)
1 parent c911f64 commit ecacb44

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

MaterialDesignThemes.Wpf/TreeListViewItem.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ public int Level
6060
DependencyProperty.Register(nameof(Level), typeof(int), typeof(TreeListViewItem), new PropertyMetadata(0));
6161

6262

63+
64+
public bool DisableExpandOnDoubleClick
65+
{
66+
get => (bool)GetValue(DisableExpandOnDoubleClickProperty);
67+
set => SetValue(DisableExpandOnDoubleClickProperty, value);
68+
}
69+
70+
public static readonly DependencyProperty DisableExpandOnDoubleClickProperty =
71+
DependencyProperty.Register("DisableExpandOnDoubleClick", typeof(bool), typeof(TreeListViewItem), new PropertyMetadata(false));
72+
6373
internal IEnumerable? Children
6474
{
6575
get => (IEnumerable?)GetValue(ChildrenProperty);
@@ -158,7 +168,7 @@ private void UpdateHasChildren()
158168
protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
159169
{
160170
base.OnMouseDoubleClick(e);
161-
if (e.ChangedButton == MouseButton.Left)
171+
if (!e.Handled && !DisableExpandOnDoubleClick && e.ChangedButton == MouseButton.Left)
162172
{
163173
IsExpanded = !IsExpanded;
164174
}

0 commit comments

Comments
 (0)