I am trying to emulate Windows general behavior for editing treeview nodes: clicking on an already selected node enters the editing mode.
With RadTreeView (WPF) I can handle the previewMouseDown events, as well as the left and right mouse button preview events of the treeview.
In the event handler i call begin edit (TV.SelectedContainer.BeginEdit() or myradTreeviewitem.BeginEdit).
It does not work with a Left Mouse Click
In other words, BeginEdit does not work when called on a previewMouseDown if the left button triggered the event.
The PreviewMouseRightButtonDown works using the same handler.
The PreviewMouseLeftButtonDown works using the same handler.
Is there a reason why this is so. It is important for my application that I can keep windows interface conventions like clicking on the selected Tree Node enters editing mode.
Any help will be appreciated.
Thanks
With RadTreeView (WPF) I can handle the previewMouseDown events, as well as the left and right mouse button preview events of the treeview.
AddHandler _TV.PreviewMouseDown, AddressOf tv_PreviewMouseDown
In the event handler i call begin edit (TV.SelectedContainer.BeginEdit() or myradTreeviewitem.BeginEdit).
Private Sub tv_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)This code works perfectly with a Righ Mouse click.
Dim s = TryCast(e.OriginalSource, UIElement)
If s Is Nothing Then Exit Sub
Dim Item = UI.Library.FindVisualParent(Of Telerik.Windows.Controls.RadTreeViewItem)(s)
If Item Is Nothing Then Exit Sub
If Item.IsSelected Then
_TV.SelectedContainer.BeginEdit()
' Item.BeginEdit
End If
End Sub
UI.Library.FindVisualParent is a small function that returns the parent of Type T of an element
It does not work with a Left Mouse Click
In other words, BeginEdit does not work when called on a previewMouseDown if the left button triggered the event.
The PreviewMouseRightButtonDown works using the same handler.
The PreviewMouseLeftButtonDown works using the same handler.
Is there a reason why this is so. It is important for my application that I can keep windows interface conventions like clicking on the selected Tree Node enters editing mode.
Any help will be appreciated.
Thanks