Prevent automatic check/uncheck on disabled TreeViewItems

4 posts, 0 answers
  1. Nemanja
    Nemanja avatar
    27 posts
    Member since:
    Mar 2011

    Posted 07 May 2012 Link to this post

    Hi,

    I'm using a RadTreeView control and have got the check list feature to work for me nicely, but am having problems with items in the tree that are disabled.

    The tree is dynamically created and uses certain conditions to make some nodes disabled, and set to checked. The tree view is working against a collection of items and if an item from the tree is in that collection, then users should not be able to click on it, or change it's checked status.

    the disabled part works perfectly, but when a parent node is clicked, it automatically changes the checked value on all child nodes, including the disabled ones.

    is there any way to stop this from happening?

    thanks,
    nemanja
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 10 May 2012 Link to this post

    Hi Nemanja,

     Can you please confirm that the IsInTriState property of the RadTreeView is set to false? If yes, could you please send us your XAML, this way we would be better able to advice you? Thank you in advance.

    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Nemanja
    Nemanja avatar
    27 posts
    Member since:
    Mar 2011

    Posted 10 May 2012 Link to this post

    Hi Petar,

    I can't really confirm that because we are using the IsInTriState property and have it explicitly set to true. We would like to know if a node is fully or partially selected in terms of its children. Is there no way to make it recognise enabled/disabled with this feature switched on?

    It isn't obvious to me why the tristate property should make the control behave differently in this instance? Surely if something is disabled its checkstate should be unaffected by changes to enabled elements?

    Thanks,
    Nemanja
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 14 May 2012 Link to this post

    Hello Nemanja,

     When a RadTreeViewItem is disabled it means that User cannot select it, check it, expand it, collapse it, drag and drop it. This does not mean that you cannot do these operations programmatically. Same is true if these operations are side effect of another operation. Such side effect could be the TriStateLogic - checking a parent enabled node will check all of the child nodes. This does not mean that the disabled child nodes are checked by the User - they are checked by a side effect internal tri-state logic.
    What you could do is to implement your own tri-state logic in the ViewModels and check whether an item is disabled before turning its CheckState to Off. You can use this post as a demonstration of making a tri-state behavior in your ViewModels.
     

    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top