Say you have a button which clears the old nodes and adds a number of new child nodes to the currently selected node. If the selected node is collapsed, the newly added nodes are not visible but the scrollbar updates as if they were. Workaround the issue by using the BeginUpdate/EndUpdate methods of RadTreeView when updating the nodes: radTreeView1.BeginUpdate(); node.Nodes.Clear(); foreach (RadTreeNode treeNode in nodes) { node.Nodes.Add((RadTreeNode)treeNode.Clone()); } radTreeView1.EndUpdate();
IMPROVE. RadTreeView - add support for DataBindings of RadTreeNode Resolution: The feature is duplicated with feedback item ADD. RadTreeView - add support for binding the checkboxes of the nodes to a field in the data Here is the link to item: http://feedback.telerik.com/Project/154/Feedback/Details/112624-add-radtreeview-add-support-for-binding-the-checkboxes-of-the-nodes-to-a-field.
To reproduce use this code: RadTreeView tree = new RadTreeView(); tree.Name = "tree"; RadTreeNode[] nodes = new RadTreeNode[5]; for (int i = 0; i < nodes.Length; ++i) nodes[i] = new RadTreeNode(i.ToString()); tree.Nodes.AddRange(nodes); tree.Nodes.Clear(); tree.Nodes.AddRange(nodes);
Summary of the program logic: The app allows the user to edit hierarchical data that is serialized/deserialized from an XML file. It is first deserialized into a collection of business objects that are structured hierarchically: MetadataNode --LongNameEnglish::string --LongNameArabic::string --Nodes::BindingList<MetadataNode> I take this hierarchical collection and flatten it out so that each node references the Id of its parent node (self-referencing): --Node 1 (Id:1, ParentId:null) ----Node 1-1 (Id:2, ParentId:1) ----Node 1-2 (Id:3, ParentId:1) In the attached project, if you run it and select File->Open Data File and browse to and select the Metadata2.xml file that I included in the root of the ZIP archive, then click the add button (the icon with the "+" symbol on top of the treeview control), the code in the AddNode function works as expected--it calls RadTreeView.BeginUpdate(), adds a new item to the datasource (a BindingList<MetadataNode> collection), then calls RadTreeView.EndUpdate(). However, if you run the application and select File->New Data File and click the add button, the same code throws a NullReferenceException when the RadTreeView.EndUpdate() method is called.
1. Create a new project with RadTreeView. 2. When handling Form.Load event add two root nodes and several child nodes. 3. Run the project and vertical scrollbar will be visible when it is not needed.
When you change the dock state of window in RadDock, the hosted RadTreeView shows only the nodes from first level, if data relation binding is used.
If you add nodes in the following manner: Private arCategories() As String = {"Not Used", "Category1", "Category2", "Category3", "Category4", "Category5"} Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim node As RadTreeNode node = Me.RadTreeView1.Nodes.Add(arCategories(1)) node.Image = My.Resources.img1 AddItems(node) node = Me.RadTreeView1.Nodes.Add(arCategories(2)) node.Image = My.Resources.img2 AddItems(node) node = Me.RadTreeView1.Nodes.Add(arCategories(3)) node.Image = My.Resources.img3 AddItems(node) node = Me.RadTreeView1.Nodes.Add(arCategories(4)) node.Image = My.Resources.img4 AddItems(node) node = Me.RadTreeView1.Nodes.Add(arCategories(5)) node.Image = My.Resources.img5 AddItems(node) For Each nd As RadTreeNode In Me.RadTreeView1.Nodes For Each n As RadTreeNode In nd.Nodes n.Image = nd.Image Next Next End Sub Private Sub AddItems(ByVal node As RadTreeNode) For i As Integer = 1 To 4 node.Nodes.Add("Item" & i) Next End Sub the vertical scroll is not calculated correctly.
Use the scrollintoview method of the tree to select a node while the treeview has not the focus.
The RadTreeView throws NullReferenceException when scrolling is performed if it is loaded from xml document. Loading the following xml document causes the issue: <TreeView xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ShowLines="true"> <Nodes Expanded="true" Text="Test1" ImageIndex="0"> <Nodes Expanded="true" Text="Test2" ImageIndex="0"> <Nodes Expanded="true" Text="Test3" ImageIndex="2"> <Nodes Expanded="true" Text="Test4" ImageIndex="1" BackColor="232,255,232" NumberOfColors="1"> <Nodes Text="Test5" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test6" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test7" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> </Nodes> <Nodes Expanded="true" Text="Test18" ImageIndex="1"> <Nodes Text="Test9" ImageIndex="3" /> <Nodes Text="Test10" ImageIndex="3" /> </Nodes> <Nodes Expanded="true" Text="Test11" ImageIndex="1" BackColor="232,255,232" NumberOfColors="1"> <Nodes Text="Test12" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test13" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> </Nodes> <Nodes Expanded="true" Text="Test14" ImageIndex="1"> <Nodes Text="Test15" ImageIndex="3" /> <Nodes Text="Test16" ImageIndex="3" /> <Nodes Expanded="true" Text="Test17" ImageIndex="4"> <Nodes Expanded="true" Text="Test18" ImageIndex="1" BackColor="232,255,232" NumberOfColors="1"> <Nodes Text="Test19" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test20" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> </Nodes> </Nodes> </Nodes> </Nodes> <Nodes Expanded="true" Text="Test20" ImageIndex="2"> <Nodes Expanded="true" Text="Test21" ImageIndex="1" BackColor="232,255,232" NumberOfColors="1"> <Nodes Text="Test22" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test23" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> </Nodes> <Nodes Expanded="true" Text="Test24" ImageIndex="1"> <Nodes Text="Test25" ImageIndex="3" /> <Nodes Text="Test26" ImageIndex="3" /> <Nodes Text="Test27" ImageIndex="3" /> <Nodes Text="Test28" ImageIndex="3" /> </Nodes> <Nodes Expanded="true" Text="Test29" ImageIndex="1" BackColor="232,255,232" NumberOfColors="1"> <Nodes Text="Test30" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test31" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> </Nodes> </Nodes> </Nodes> <Nodes Expanded="true" Text="Test32" ImageIndex="0"> </Nodes> <Nodes Expanded="true" Text="Test33" ImageIndex="0"> <Nodes Expanded="true" Text="Test34" ImageIndex="0"> <Nodes Expanded="true" Text="Test35" ImageIndex="1" BackColor="232,255,232" NumberOfColors="1"> <Nodes Text="Test36" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test37" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test38" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> </Nodes> <Nodes Expanded="true" Text="Test39" ImageIndex="1"> <Nodes Text="Test40" ImageIndex="3" /> <Nodes Text="Test41" ImageIndex="3" /> </Nodes> <Nodes Expanded="true" Text="Test42" ImageIndex="1" BackColor="232,255,232" NumberOfColors="1"> <Nodes Text="Test43" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test44" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test45" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test46" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> </Nodes> </Nodes> <Nodes Expanded="true" Text="Test47" ImageIndex="0"> <Nodes Expanded="true" Text="Test48" ImageIndex="1" BackColor="232,255,232" NumberOfColors="1"> <Nodes Text="Test49" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test50" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> </Nodes> <Nodes Expanded="true" Text="Test51" ImageIndex="1" BackColor="232,255,232" NumberOfColors="1"> <Nodes Text="Test52" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test53" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> </Nodes> </Nodes> <Nodes Expanded="true" Text="Test54" ImageIndex="0"> <Nodes Expanded="true" Text="Test55" ImageIndex="1" BackColor="232,255,232" NumberOfColors="1"> <Nodes Text="Test56" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test57" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test58" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test59" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> <Nodes Text="Test60" ImageIndex="3" BackColor="232,255,232" NumberOfColors="1" /> </Nodes> </Nodes> </Nodes> </Nodes> </TreeView>
To reproduce: for (int i = 0; i < 10; i++) { RadTreeNode node = new RadTreeNode("Node " + i); radTreeView1.Nodes.Add(node); node.Style.GradientStyle = GradientStyles.Solid; node.Style.BackColor = System.Drawing.Color.LightCoral; } Workaround: use NodeFormatting
1. Set CheckBoxes property of RadTreeView to true. 2. Set TriStateMode property of RadTreeView to true. 3. Cancel the node checked state property of a node in the NodeCheckedChanging event 4. The parent node will not be in intermediate checked state.
I want (for some reason) make nodes in treeview checked in "one line" (i.e. in Nodes collection of any node - no more than one child could be checked). Also, latest (i.e. deepest) node should be selected. In attached example (see Example.zip): 1. Check node "Node 19" (as a result - nodes "Node 1", "Node 18" and "Node 19" checked and "Node 19" is selected). 2. Uncheck node "Node 1". Should be - nodes "Node 18" and "Node 19" checked and "Node 19" is selected. As a result - exception arised (see text of exception in Exception.zip). I suppose that it may be connected with "invisibility" of "Node 19" (I mean, if I make this actions with "Node 3" - it works fine).
Private Sub LoadTvObjectInApp() Dim objectInApps As IQueryable(Of ObjectInApp) objectInApps = _context.ObjectInApps.Where(Function(c) (c.ApplicatieCode = "zis") AndAlso Not (c.GroepNaam = "hulp" AndAlso c.IsSysteemObject = True))
It seems that when you try to collapse a node the application thread crashes. The exception seems to point pretty firmly at the Telerik control - when it is applying styles to a node?
FIX. RadTreeView - exception while filtering a tree scrolled to the bottom end point
The problem may be reproduced in example application in TreeView/First Look The scenario is as follows: -enter some text as a filter -delete text - filter should be off -add new node by context menu -> "New Node" appears twice in the tree view
The check boxes are squeezed when the expanded state of the child nodes is changed in NodeCheckedChanged event. Possible workaround: use Begin-End update block
When using TriStateMode with AutoCheckChildNodes, there is no way to determine whether the events are raised by a user action or by programatically checking a node. view: CheckedMode enumeration for details
The checked state of parent node is incorrect when TriStateMode is enabled and it has a child node with no check type.
To reproduce: public Form1() { InitializeComponent(); for (int i = 0; i < 10; i++) { RadTreeNode node = new RadTreeNode("Root node " + i); for (int j = 0; j < 10; j++)