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

RadTreeView Checked Event

1 Answer 58 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Gareth Repton
Top achievements
Rank 1
Gareth Repton asked on 24 Nov 2010, 03:57 PM
Hi,

I am using the rad tree view without data binding, and am hooking into the checked changed event of the tree to alter my object model with the new selection in the background code. The checked changed event fires for every sub-node of a node in the tree to update its status, is there an event that fires after all of the checked events have completed on the tree?

Thanks for any help in advance.

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 29 Nov 2010, 02:54 PM
Hi Gareth Repton,

From the information you sent us, it appears that your RadTreeView has its  IsInTriStateMode  set to true.
In this case, when you check a TreeVeiwItem, the check sequence is as follows: children, parent/grandparents, the initially checked item ( the one you have checked first ). You can now use the RadTreeViewCheckEventArgs.IsUserInitiated property . When it is true, the item you have checked first is about to be checked and you can perform your logic like so:
private void radTreeView_Checked(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            RadTreeViewItem current = e.OriginalSource as RadTreeViewItem;
            MessageBox.Show("Current check: " + current.Header.ToString());
  
            bool isInitiallyChecked = (e as RadTreeViewCheckEventArgs).IsUserInitiated;
            if (isInitiallyChecked)
            {
                MessageBox.Show(current.Header.ToString() + " last checked!");
                current.IsSelected = true;
            }
        }

The described approach is used in the attached project, so give it a try and let  me know if it satisfies you. We would be glad to assist you further.
Best wishes,
Petar Mladenov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
TreeView
Asked by
Gareth Repton
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or