RadTreeView Checked Event

2 posts, 0 answers
  1. Gareth Repton
    Gareth Repton avatar
    1 posts
    Member since:
    Feb 2010

    Posted 24 Nov 2010 Link to this post

    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.
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 29 Nov 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top