To reproduce: Add a RadTreeView with some nodes and you will notice that the font is different than other controls. Workaround: void tree_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { e.NodeElement.ContentElement.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault; }
To reproduce: Add a RadTreeView ,add nodes, enable TriState, disable AutoCheckChildNodes and use this code: void cxTreeView2_NodeCheckedChanging(object sender, RadTreeViewCancelEventArgs e) { if (!cxTreeView2.AutoCheckChildNodes && cxTreeView2.CheckBoxes && cxTreeView2.TriStateMode) { cxTreeView2.TreeViewElement.NodeCheckedChanging -= cxTreeView2_NodeCheckedChanging; if (e.Node.CheckState == ToggleState.Indeterminate) { e.Cancel = true; e.Node.CheckState = ToggleState.On; CheckAllChildren(e.Node); } cxTreeView2.TreeViewElement.NodeCheckedChanging += cxTreeView2_NodeCheckedChanging; } } void CheckAllChildren(RadTreeNode parent) { foreach (var node in parent.Nodes) { node.CheckState = ToggleState.On; CheckAllChildren(node); } } Click a top node two times and remove the mouse from the checkbox, it is now showing as Indetermined but the data item is on. Workaround: void cxTreeView2_NodeCheckedChanging(object sender, RadTreeViewCancelEventArgs e) { if (!cxTreeView2.AutoCheckChildNodes && cxTreeView2.CheckBoxes && cxTreeView2.TriStateMode) { cxTreeView2.TreeViewElement.NodeCheckedChanging -= cxTreeView2_NodeCheckedChanging; if (e.Node.CheckState == ToggleState.Indeterminate) { e.Cancel = true; e.Node.CheckState = ToggleState.On; CheckAllChildren(e.Node); cxTreeView2.TreeViewElement.Update(RadTreeViewElement.UpdateActions.Reset); } cxTreeView2.TreeViewElement.NodeCheckedChanging += cxTreeView2_NodeCheckedChanging; } } void CheckAllChildren(RadTreeNode parent) { foreach (var node in parent.Nodes) { node.CheckState = ToggleState.On; CheckAllChildren(node); } }
Workaround: RadTreeView1.TreeViewElement.TreeNodeProvider.Reset()
To reproduce: - add a RadTreeView - enable multiselect - select at least 1 node - call radTreeView1.SelectedNodes.Clear() Workaround: Clear the nodes manually: foreach (var node in this.radTreeView1.SelectedNodes.ToList()) { node.Selected = false; }
How to reproduce: check the attached project Workaround: create a custom TreeViewDragDropService class CustomTreeViewElement : RadTreeViewElement { protected override Type ThemeEffectiveType { get { return typeof(RadTreeViewElement); } } protected override TreeViewDragDropService CreateDragDropService() { return new CustomDragDropService(this); } } class CustomTreeView : RadTreeView { protected override RadTreeViewElement CreateTreeViewElement() { return new CustomTreeViewElement(); } public override string ThemeClassName { get { return typeof(RadTreeView).FullName; } } } class CustomDragDropService : TreeViewDragDropService { public CustomDragDropService(RadTreeViewElement owner) : base(owner) { } protected override bool CancelPreviewDragDrop(RadDropEventArgs e) { return false; } }
To reproduce: private void Form1_Load(object sender, EventArgs e) { this.radTreeView1.Nodes.Add("Node1"); this.radTreeView1.Nodes.Add("Node2"); this.radTreeView1.Nodes.Add("Node3"); this.radTreeView1.Nodes.Add("Node4"); this.radTreeView1.Nodes.Add("Node5"); this.radTreeView1.Nodes.Add("Node6"); this.radTreeView1.Nodes["Node1"].Nodes.Add("Node11"); this.radTreeView1.Nodes["Node1"].Nodes.Add("Node12"); this.radTreeView1.Nodes["Node1"].Nodes.Add("Node13"); this.radTreeView1.Nodes["Node1"].Nodes.Add("Node14"); this.radTreeView1.Nodes["Node2"].Nodes.Add("Node21"); this.radTreeView1.Nodes["Node2"].Nodes.Add("Node22"); this.radTreeView1.Nodes["Node2"].Nodes.Add("Node23"); this.radTreeView1.Nodes["Node2"].Nodes.Add("Node24"); this.radTreeView1.Nodes["Node3"].Nodes.Add("Node31"); this.radTreeView1.Nodes["Node3"].Nodes.Add("Node32"); this.radTreeView1.Nodes["Node3"].Nodes.Add("Node33"); this.radTreeView1.Nodes["Node3"].Nodes.Add("Node34"); this.radTreeView1.Nodes["Node4"].Nodes.Add("Node41"); this.radTreeView1.Nodes["Node4"].Nodes.Add("Node42"); this.radTreeView1.Nodes["Node4"].Nodes.Add("Node43"); this.radTreeView1.Nodes["Node4"].Nodes.Add("Node44"); this.radTreeView1.Nodes["Node5"].Nodes.Add("Node51"); this.radTreeView1.Nodes["Node5"].Nodes.Add("Node52"); this.radTreeView1.Nodes["Node5"].Nodes.Add("Node53"); this.radTreeView1.Nodes["Node5"].Nodes.Add("Node54"); this.radTreeView1.Nodes["Node6"].Nodes.Add("Node61"); this.radTreeView1.Nodes["Node6"].Nodes.Add("Node62"); this.radTreeView1.Nodes["Node6"].Nodes.Add("Node63"); this.radTreeView1.Nodes["Node6"].Nodes.Add("Node64"); } Workaround: add the nodes in the form's constructor. Second workaround: Me.RadTreeView1.TreeViewElement.Update(Telerik.WinControls.UI.RadTreeViewElement.UpdateActions.Reset)
Pressing arrow down or up when renaming item on a list with scrollbar throws null pointer exception. Example solution in attachement. Steps to reproduce with attached solution: Scroll down to last element (A99) Press F2 (rename) and rename to "0" Press arrow up or down on a keyboard (without pressing enter after rename). -> NullReferenceException is thrown.
The GetNodeByName method will return a node with the specified name
Workaround: Instead of {RadTreeNode}.Nodes.Clear(), use while ({RadTreeNode}.Nodes.Count>0) { {RadTreeNode}.Nodes.RemoveAt(0); }
There should be a convenient way to hide the expander icon and to show lines when using full lazy mode.
Workaround: raise a flag before the delete operation and cancel the SelectedNodeChanging event
To reproduce: private void RadTreeView1_NodeCheckedChanging(object sender, Telerik.WinControls.UI.RadTreeViewCancelEventArgs e) { Console.WriteLine(e.Action); } The action is always unknown.
To reproduce - Add RadTreeView with some nodes to a blank form. - Set the MultiSelect property to true. - Select\Deselect a node with code. Resolution: The SelectedNodeChanged event should not be fired when selected/deselected the node programmatically. We added a new event SelectedNodesChanged which is fired when the SelectedNodes collection changes.
To reproduce: protected override void OnLoad(EventArgs e) { base.OnLoad(e); radTreeView1 = new RadTreeView(); radTreeView1.Parent = this; for (int i = 0; i < 5; i++) { RadTreeNode n1 = new RadTreeNode("Node" + i); this.radTreeView1.Nodes.Add(n1); if (i % 2 == 0) { for (int j = 0; j < 2; j++) { RadTreeNode n2 = new RadTreeNode("Node" + i + "." + j); n1.Nodes.Add(n2); if (j % 2 == 0) { for (int k = 0; k < 2; k++) { RadTreeNode n3 = new RadTreeNode("Node" + i + "." + j + "." + k); n2.Nodes.Add(n3); } } } } } radTreeView1.ShowRootLines = false; radTreeView1.ShowLines = false; } Workaround: void radTreeView1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { if (radTreeView1.ShowLines == false) { if (e.NodeElement.LinesContainerElement.Children.Count > 0) { TreeNodeLineElement lineElement = (TreeNodeLineElement)e.NodeElement.LinesContainerElement.Children[0]; lineElement.Visibility = ElementVisibility.Collapsed; } } }
To reproduce: DataTable dt = new DataTable(); public Form1() { InitializeComponent(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("ParentID", typeof(int)); dt.Columns.Add("NodeName", typeof(string)); dt.Rows.Add(1, 0, "Category1"); dt.Rows.Add(2, 1, "Category2"); dt.Rows.Add(3, 0, "Category3"); dt.Rows.Add(4, 3, "Category4"); dt.Rows.Add(5, 3, "Category5"); dt.Rows.Add(6, 3, "Category6"); dt.Rows.Add(7, 6, "Category7"); dt.Rows.Add(8, 6, "Category8"); this.radTreeView1.DataSource = dt; this.radTreeView1.DisplayMember = "NodeName"; this.radTreeView1.ChildMember = "ID"; this.radTreeView1.ParentMember = "ParentID"; this.radTreeView1.ExpandAll(); this.radTreeView1.AllowAdd = true; this.radTreeView1.AllowRemove = true; this.radTreeView1.AllowDefaultContextMenu = true; this.radLabel1.Text = "Number of rows: " + dt.Rows.Count; this.radTreeView1.NodeRemoved += radTreeView1_NodeRemoved; } private void radTreeView1_NodeRemoved(object sender, Telerik.WinControls.UI.RadTreeViewEventArgs e) { this.radLabel1.Text = "Number of rows: " + dt.Rows.Count; } Workaround: perform the delete operation programmatically by modifying the default context menu: this.radTreeView1.ContextMenuOpening += radTreeView1_ContextMenuOpening; private void radTreeView1_ContextMenuOpening(object sender, TreeViewContextMenuOpeningEventArgs e) { foreach (RadMenuItem item in e.Menu.Items) { if (item.Text == "&Delete") { item.Visibility = Telerik.WinControls.ElementVisibility.Collapsed; } else { item.Visibility = Telerik.WinControls.ElementVisibility.Visible; } } RadMenuItem removeItem = new RadMenuItem("Remove"); e.Menu.Items.Add(removeItem); removeItem.Click += item_Click; } private void item_Click(object sender, EventArgs e) { DeleteSubNodes(this.radTreeView1.SelectedNode); this.radLabel1.Text = "Number of rows: " + dt.Rows.Count; } private void DeleteSubNodes(Telerik.WinControls.UI.RadTreeNode node) { if (node.Nodes.Count == 0) { dt.Rows.Remove(((DataRowView)node.DataBoundItem).Row); } else { foreach (RadTreeNode n in node.Nodes) { DeleteSubNodes(n); } dt.Rows.Remove(((DataRowView)node.DataBoundItem).Row); } }
Start dragging a node and scroll using the mouse wheel. While scrolling, drop the node.
To reproduce: - Open the Property builder, add some nodes and disable them. - There is no way to enable them at design time. Workaround. Disable the nodes at runtime.
Sort the selected nodes according to their position in the tree
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.
Please refer to the attached gif file and sample project. The screen tip position is not the same each time. Hence, the issue may not be reproducible every time. Workaround: use the TooltiptextNeeded event.