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

Force not check some checkbox in TriStateMode.

2 Answers 47 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Peter Bogoyavlensky
Top achievements
Rank 1
Peter Bogoyavlensky asked on 21 Dec 2010, 11:52 AM
I want to prevent some nodes to check by some condition (let's say that is node.Enabled in this case - actually it can be more complicated).
Also I want to use TriStateMode to simplify process of control node's check state and (mainly) make visible to user that some lower nodes in tree are not checked.

In this example, nodes "Not checkable" could not be checked. And, if I check root node "Main node" - this example works fine. But when I change "block 1" and "block 2" and try to check root node - it don't. Event fired for node "Not Checkable node", invert it, return to root node and uncheck it.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    RadTreeView1.TriStateMode = True
    RadTreeView1.AutoCheckChildNodes = True
    RadTreeView1.Nodes.Clear()
 
    Dim mainNode As Telerik.WinControls.UI.RadTreeNode
    Dim newNode As Telerik.WinControls.UI.RadTreeNode
    Dim newSubNode As Telerik.WinControls.UI.RadTreeNode
    mainNode = New Telerik.WinControls.UI.RadTreeNode("Main node")
    mainNode.Enabled = True
    RadTreeView1.Nodes.Add(mainNode)
 
    ' block 1 - start
    newNode = New Telerik.WinControls.UI.RadTreeNode("Checkable node")
    newNode.Enabled = True
    mainNode.Nodes.Add(newNode)
    newSubNode = New Telerik.WinControls.UI.RadTreeNode("Checkable node 1")
    newSubNode.Enabled = True
    newNode.Nodes.Add(newSubNode)
    ' block 1 - end
 
    ' block 2 - start
    newNode = New Telerik.WinControls.UI.RadTreeNode("Not Checkable node")
    newNode.Enabled = False
    mainNode.Nodes.Add(newNode)
    newSubNode = New Telerik.WinControls.UI.RadTreeNode("Not Checkable node 1")
    newSubNode.Enabled = False
    newNode.Nodes.Add(newSubNode)
    ' block 2 - end
 
    RadTreeView1.ExpandAll()
End Sub
 
Private Sub RadTreeView1_NodeCheckedChanged(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.RadTreeViewEventArgs) Handles RadTreeView1.NodeCheckedChanged
    If e.Node.Checked AndAlso Not e.Node.Enabled Then
        e.Node.Checked = False
    End If
End Sub

I am using Telerik version=2010.1.10.308

Another question: How can I maintain view of checkbox in TriStateMode? I mean that "grey sign" instead of "black sign" is not so obvious for user - I would prefer to change color or something like that. May be there is another method to control/theming checkbox? If it's possible, I would not use TriState and maintain checkboxes state (and checkbox representation) manually in code.

2 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 27 Dec 2010, 11:06 AM
Hello Peter Bogoyavlensky,

I tested the described case using our latest release and could not observe any issue related with the tree state mode and disabled state in RadTreeView. Please, could you confirm that you are using our latest release. If the issue continues to appear, please send us a sample project which reproduces the issue and describe the exact steps. Thank you in advance for your understanding and cooperation.

I am looking forward to your reply.

Greetings, Julian Benkov
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
0
Stefan
Telerik team
answered on 18 Mar 2011, 04:35 PM
Hello Peter,

Please note that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out. For more information on our latest release, please refer to this blog post.
 
Best wishes,
Stefan
the Telerik team
Tags
Treeview
Asked by
Peter Bogoyavlensky
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Stefan
Telerik team
Share this question
or