I need to disable doubleclick behaviour and make treeview open only by clicking an indicator. Is there a way to do that?
And yet. Is there a way to subscribe to doubleclick event? I don't see corresponding event in tree.
Thank you.
Hi dprosko!
It is possible to create own class, that inherits XamWebTreeItem and override OnMouseLeftButtonUp method:
public class CustomTreeItem : XamWebTreeItem { protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) { this.IsExpanded = !this.IsExpanded; }
and use it instead XamWebTreeItem in XamWebTree:
<igTree:XamWebTree x:Name="xTree"> <local:CustomTreeItem x:Name="TestItem1" Header="Test Item 1" MouseLeftButtonDown="TestItem_MouseLeftButtonDown" > <igTree:XamWebTreeItem x:Name="SubItem1" Header="SubItem 1" /> </local:CustomTreeItem> <igTree:XamWebTreeItem x:Name="TestItem2" Header="Test Item 1" /> </igTree:XamWebTree>
I hope that can help :)
Best Regards!
Mihail
}
Thank you for reply but the way you suggested is not working correctly. Root nodes open when I click item header and won't open when I click expander triangle. Clicking child node makes root node to close. Sometimes other nodes are opening instead of closing/opening the node I click.
This is what I want:
My tree nodes load asynchronously and I want to disable doubleclick and make users click expander icon instead. Icon appears only when child nodes has been loaded so I want to make user wait until current node is fully populated. Is there a way to do that?
Yes this works fine for me. Thank you very much
In that case you can override OnMouseLeftButtonDown in your class that inherits XamWebTreeItem:
Double click implementation is placed in that method. When you override it with empty one you can suppress double click:
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e){ return;}
<igTree:XamWebTree x:Name="xTree"> <local:CustomTreeItem x:Name="TestItem1" Header="Test Item 1"> <local:CustomTreeItem x:Name="SubItem1" Header="SubItem 1"> <local:CustomTreeItem x:Name="SubItem3" Header="SubItem 3"/> </local:CustomTreeItem> </local:CustomTreeItem> <local:CustomTreeItem x:Name="TestItem2" Header="Test Item 1" /></igTree:XamWebTree>
If you want to turn on and turn off double click you can add a property in your inheritor and call in OnMouseLeftButtonDown base method depenting on property value.
Regards!