This is a migrated thread and some comments may be shown as answers.

IsExpandOnDblClickEnabled="False" doesn't work

5 Answers 83 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Roman
Top achievements
Rank 1
Roman asked on 28 Aug 2012, 10:53 AM
Hi!

By default treeview expands nodes by double clicking on items.

I would like to change this, so that single click expands nodes and double click does nothing.
I used this in xaml (in RadTreeView control): 

IsExpandOnDblClickEnabled="False"
IsExpandOnSingleClickEnabled="True"

While single click now works, the problem is, that double click stil expands and collapses nodes. 

Here is some additional info:

Silverlight version: 5.0
OS: Win7 x64
Browser: IE9 v9.0.8112.16421 or Chrome v21.0.1180.83
Telerik: 2012.2.725.1050 (runtime version: v4.0.30319)
Preffered language VB.NET

update:
I just checked example at http://demos.telerik.com/silverlight/#TreeView/CheckBoxLinesSupport 
and it's the same situation - if you select SingleClick at "Expand on click" options, double click still expand/collapse node...

Can someone confirm, that this is a bug in this control?

Roman

5 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 29 Aug 2012, 12:16 PM
Hello Roman,

The logic you want to use is a custom one and it is not implemented in the RadTreeView, because a double click always contains a single one.

There is a workaround that I can suggest to you. First both properties IsExpandOnDblClickEnabled and IsExpandOnSingleClickEnabled should be set to "False". And second, you should handle the Click event and wait (using a DispatcherTimer for example) to see whether there would be second click in a short interval of time and if so - do noting, otherwise expand/collapse the RadTreeView.

Regards,
Stefan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Roman
Top achievements
Rank 1
answered on 29 Aug 2012, 05:35 PM
Hello, Stefan!

Thanks for your tip. I have done as you have suggested and now it works as it should.

Have a nice day,
Roman
0
Anjani
Top achievements
Rank 1
answered on 20 Sep 2012, 10:54 AM
Hi Stefan,
Im working with radtreeview in Silverlight. Version of telerik controls : 2012.2.725.1050. Radtreeview supports these properties :
IsExpandOnSingleClickEnabled and IsExpandOnDblClickEnabled 
to control epansion and collapsing of nodes. My requirement is that I want to disable node expand and collapse on 'Enter' key press. Is this functionality supported yet ? Can you suggest anything for this requirement ?

Awaiting your response
Thanks
Anjani Jaswal
0
Stefan
Telerik team
answered on 24 Sep 2012, 12:53 PM
Hi Anjani,

The behavior you want is supported and here is my suggestion how to implement it.

First you have to get the pressed key from the RadTreeViewItem's KeyDown event. But because the RadTreeView handles this event you should attach a handler listening to handled events. The best way to do it is to attach a KeyDown (handled true) handler in the ItemPrepared event of the TreeView. After that you can use the pressed key as a condition in an if statement in the PreviewExpand/Collapse events to check whether the pressed key is "Enter". On the other hand "Enter" can be used when editing a node and it is a good idea to add a second condition in this if statement - IsEditing != true. And finally if both condition are fulfilled then you just have to handle the event.

You can check this implementation in the project I have attached.

Regards,
Stefan
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Anjani
Top achievements
Rank 1
answered on 26 Sep 2012, 04:58 AM
Hi Stefan,

Thanks a ton for your suggestion.. This is exactly what I needed..

Regards
Anjani
Tags
TreeView
Asked by
Roman
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Roman
Top achievements
Rank 1
Anjani
Top achievements
Rank 1
Share this question
or