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

TreeView event to RadTreeView

1 Answer 82 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Roger
Top achievements
Rank 1
Roger asked on 26 May 2011, 07:42 AM
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;
                }
            }
            richTextBox.UpdateEditorLayout();
        }

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?

1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 28 May 2011, 01:59 PM
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
Tags
TreeView
Asked by
Roger
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or