We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

What's the event for a row double click that's strictly for the top-most parent?

I have a TreeViewAdv that looks like this:
Tier 1.a
l-------Tier 2.a
               l---------Tier 3.a
Tier 1.b
l-------Tier 2.a
l-------Tier 2.b
l-------Tier 2.c
               l---------Tier 3.a

What's the specific event that gets triggered when rows from Tier 1 gets double clicked? Because for now I'm using the TreeViewAdv's DoubleClick and it works BUT it works for every double click within the TreeViewAdv, if they double click outside the rows or on the node rows, it still gets triggered. I need an event that's only for the top-most parent.

4 Replies

VR Vijayalakshmi Roopkumar Syncfusion Team November 25, 2019 12:54 PM UTC

Hi Mark

Thank you for using our Syncfusion Products.

We are currently checking your requirement to have the event on double clicking the top most parent of TreeViewAdv alone and not other TreeViewItemAdv. We will update the details by 27th Nov 2019.

Regards
Vijayalakshmi V.R.


SM Suriyaprabha Murugabaskaran Syncfusion Team November 27, 2019 02:27 PM UTC

Hi Mark
Currently, TreeViewAdv does not have specific event to be fired while double click only the top most parent. We have prepared the simple sample for your reported requirement. In this sample, we have created one boolean variable ‘istopMost ‘ and checked the treeview selecteditem with each items in treeview and enable the boolean property when the “SelectedItem” matches the TopLevelNode. Using the Boolean field in double click event of treeviewadv we have done some actions. 
We have attached the sample link for your reference. Please refer it.

Sample Link: https://www.syncfusion.com/downloads/support/forum/149352/ze/TREEVI_4-2078692740-2057609734
 
Please check the sample and let us know whether we have understood your scenario properly or not. 
Regards, 
Suriyaprabha M. 



MA Mark November 29, 2019 10:21 AM UTC

Thank you for the reply, I really appreciate the solution but it's still not quite there yet. 

I'm still having this specific problem that I've laid out initially "BUT it works for every double click within the TreeViewAdv, if they double click outside the rows or on the node rows, it still gets triggered."

If I tried to double click outside the selected row, the message box still shows up. I need it to only appear when the user double clicks inside the top-most node, if the user double clicks outside the top-most node this event doesn't get triggered.

I need something that says "only trigger this event if the mouse cursor is ON TOP of the top-most selected node".


VR Vijayalakshmi Roopkumar Syncfusion Team December 2, 2019 12:29 PM UTC

Hi Mark,

 

Thank you for your update.

 

Query :  need something that says "only trigger this event if the mouse cursor is ON TOP of the top-most selected node".

 

We have checked your query and understood that you want to hook the double click event only on clicking the node text region and not on besides the node. You can restrict this behavior by fetching the TextBlock and invoke the previewMouseDown event. Please find the code for the same.

 

 

Code:[C#]

 

 

private void MainWindow_Loaded(object sender, RoutedEventArgs e)

{

foreach (TreeViewItemAdv item in this.treeview.Items)

{

TextBlock tblock = VisualUtils.FindDescendant(item, typeof(TextBlock)) as TextBlock;

tblock.PreviewMouseDown += Tblock_PreviewMouseDown;

}

}

private void Tblock_PreviewMouseDown(object sender, MouseButtonEventArgs e)

{

if (e.ClickCount == 2)

{

MessageBox.Show("Double Clicked top most node.");

}

}

 

 

 

We have also attached the sample for your reference. Please download it from following location:

 

Sample: https://www.syncfusion.com/downloads/support/forum/149352/ze/TreeViewMousedown1473338158

 

Please try this solution and let us know if it meets your requirement.

 

Regards

Vijayalakshmi V.R.


Loader.
Up arrow icon