This question is locked. New answers and comments are not allowed.
Hi Telerik, appreciate the help as always. Here's the problem. When I right click a node (it doesn't get selected, it should, but since it doesn't I can't use the selecteditem property of the tree). I therefore use the method in the documentation.
| RadMenuItem menuItem = ((RadRoutedEventArgs)e).OriginalSource as RadMenuItem; |
| RadTreeViewItem riParent = FindParentOfType<RadTreeViewItem>(menuItem); |
| private static T FindParentOfType<T>(UIElement element) where T : UIElement |
| { |
| if (element == null) |
| return null; |
| DependencyObject parent = |
| Telerik.Windows.RoutedEvent.GetLogicalParent(element) ?? |
| VisualTreeHelper.GetParent(element); |
| while ((parent != null) && !(parent is T)) |
| { |
| parent = |
| Telerik.Windows.RoutedEvent.GetLogicalParent(parent) ?? |
| VisualTreeHelper.GetParent(parent); |
| } |
| return (T)parent; |
| } |
The FindParentOfType<T> method ALWAYS returns null. I can't get it to return the object that was right clicked. Any suggestions? I would prefer that the right click just selected the node. If there isn't a straightforward way could I trap the right click button down/up events to achieve this?
Thanks!
