DoubleClick in MVVM DataBound TreeView

Ashley

I have toyed all morning with this problem. I have a DataBound RadTreeView (with ItemsSource) that displays a Hierarchical data structure.

Because each item is displayed using the hierarchy I have no way of hooking into the "DoubleClick" event on a per-item basis.

After some time, I ended up binding SelectedItem to my ViewModel and hooking into the ItemDoubleClick event like below. Unfortunately this makes the assumption that SelectedItem is fired before ItemDoubleClick. So if possible I would love to know a way to hook into the DoubleClick event, so that I can bind the CommandParameter to the item that was double clicked.

Martin

You can use our EventToCommandBehavior to attach your command to the ItemDoubleClick event and pass the arguments of the event to the command parameters. This way you will be able to get the double clicked item and modify it as desired.

However, keep in mind that the teeview's selection will be changed on the first click of the item. On the second click the item will be already selected. If the event to command behavior doesn't work for you, can you tell me what you want to achieve? This will allow me to think of an approach that could be suitable for your scenario and guide your further.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.