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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

149352 Nov 22,2019 12:42 PM UTC Dec 2,2019 12:29 PM UTC WPF 4
loading
Tags: TreeViewAdv
Mark
Asked On November 22, 2019 12:42 PM UTC

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.

Vijayalakshmi Roopkumar [Syncfusion]
Replied On 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.

Suriyaprabha Murugabaskaran [Syncfusion]
Replied On 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. 


Mark
Replied On 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".

Vijayalakshmi Roopkumar [Syncfusion]
Replied On 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.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon