TreeView event to RadTreeView

2 posts, 0 answers
  1. Roger
    Roger avatar
    16 posts
    Member since:
    Apr 2011

    Posted 26 May 2011 Link to this post

    Good Day,

    I want to convert my treeview to a Radtreeview, hence some events are not found in radtreeview.

    From a treeview: SelectionItemChanged

            private void treeView_SelectionItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
                Tuple<Span, Span, Telerik.Windows.Controls.RadTreeViewItem> range = mapping[(XNode)((Telerik.Windows.Controls.RadTreeViewItem)e.NewValue).Tag];
                bool colorize = false;
                foreach (Span span in richTextBox.Document.EnumerateChildrenOfType<Span>())
                    if (span == range.Item1)
                        colorize = true;
                    span.HighlightColor = colorize ? Colors.Yellow : Colors.Transparent;
                    if (span == range.Item2)
                        colorize = false;

    in RadTreeView it will generate like this: 
      private void treeView_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
    I want it also to happen in my radtreeview. Since the Radtreeview SelectionChanged event does not match with the second parameter with the treeview.  How will i do it in radtreeview?
  2. Kiril Stanoev
    Kiril Stanoev avatar
    1512 posts

    Posted 28 May 2011 Link to this post

    Hello Roger,

    The most common ancestor of Telerik.Windows.Controls.SelectionChangedEventArgs and System.Windows.RoutedPropertyChangedEventArgs<object> e is RoutedEventArgs. Therefore, you can change the signature of your event handler to:

    private void SelectionChanged(object sender, System.Windows.RoutedEventArgs e)

    Best wishes,
    Kiril Stanoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top