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

Prevent automatic check/uncheck on disabled TreeViewItems

3 Answers 95 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Nemanja
Top achievements
Rank 1
Nemanja asked on 07 May 2012, 04:28 PM
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

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 10 May 2012, 07:02 AM
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 >>

0
Nemanja
Top achievements
Rank 1
answered on 10 May 2012, 08:22 AM
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
0
Petar Mladenov
Telerik team
answered on 14 May 2012, 07:39 AM
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 >>

Tags
TreeView
Asked by
Nemanja
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Nemanja
Top achievements
Rank 1
Share this question
or