TreeView PreviewUnchecked Event

2 posts, 0 answers
  1. Gnanavel
    Gnanavel avatar
    1 posts
    Member since:
    Sep 2010

    Posted 30 Sep 2010 Link to this post

    I want to prevent unchecking of treeview node based on some condition. I tried setting using e.Handled = true of TreeView PreviewUnchecked Event still the treeview node is unchecked.

     void treeView_PreviewUnchecked(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
                RadTreeViewItem item = e.OriginalSource as RadTreeViewItem;
                Node node = (Node)item.Item;

                //Select TreeNode Value when opened from Manage Screen
                if ((XYViewModel.XYPairList != null) && (XYViewModel.XYPairList.Count > 0))
                {
                  
                        MessageBox.Show("You cannot uncheck this node as this is part of XY pair. Please delete the XY Pair and uncheck again.", "Node exists in XY Pair", MessageBoxButton.OK);

                        item.CheckState = System.Windows.Automation.ToggleState.On;
                        e.Handled = true;

                }
            }

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 05 Oct 2010 Link to this post

    Hi Gnanavel,

    Unfortunately, I can't reproduce your issue. Can you please take a look at the attached example and let me know if I am missing something. Thank you in advance.

    Sincerely yours,
    Petar Mladenov
    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
  3. DevCraft banner
Back to Top