Use the following code:
public RadForm1()
{
InitializeComponent();
// This XML contains a simple tree with a root node having 3 children, the first of which is intended to be Bold
var xml = "<TreeView xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" MultiSelect=\"true\" AllowDragDrop=\"true\" LabelEdit=\"true\" AllowDrop=\"true\"> <Nodes Text=\"New Package\" Expanded=\"true\" ImageKey=\"Package\" Font=\"Microsoft Sans Serif, 8.25pt, style=Bold\"> <Tag xsi:type=\"xsd:string\"><Info><FullName>\\New Package</FullName><ObjectType>Package</ObjectType><IsRunnable>False</IsRunnable><IsContainer>true</IsContainer></Info></Tag> <Nodes Text=\"Query Engine\" ImageKey=\"QueryEngine\" Expanded=\"true\" Font=\"Microsoft Sans Serif, 8.25pt, style=Bold\"> <Tag xsi:type=\"xsd:string\"><Info><FullName>\\Query Engine</FullName><ObjectType>QueryEngine</ObjectType><IsRunnable>true</IsRunnable><IsTableEntity>true</IsTableEntity><IsCut>false</IsCut></Info></Tag> </Nodes> <Nodes Text=\"Connector\" ImageKey=\"Irion.SQLServer\"> <Tag xsi:type=\"xsd:string\"><Info><FullName>\\Connector</FullName><ObjectType>DBConnection</ObjectType><IsCut>false</IsCut></Info></Tag> </Nodes> <Nodes Text=\"Connector Link\" ImageKey=\"DatabaseDatalink\"> <Tag xsi:type=\"xsd:string\"><Info><FullName>\\Connector Link</FullName><ObjectType>DatabaseDatalink</ObjectType><IsRunnable>true</IsRunnable><IsTableEntity>true</IsTableEntity><IsCut>false</IsCut></Info></Tag> </Nodes> </Nodes></TreeView>";
this.radTreeView1.LoadXML(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(xml)));
//make sure that the following 2 nodes are bold:
this.radTreeView1.Nodes[0].Nodes[0].Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
this.radTreeView1.Nodes[0].Nodes[2].Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
var tvx = this.radTreeView1.TreeViewXml;
}
The XML returned by the tvx variable is different in 6.0 and 4.7.2. The Font for the node is serialized in 4.7.2:
But the font is missing in 6.0:
ADD. RadTreeView - add NodeRemoving event
ADD. RadTreeView - add functionality to prevent the horizontal auto-scrolling when longer nodes are clicked Comment: The new RadTreeViewElement.AutoScrollOnClick property disables the horizontal scrolling when clicking with the mouse on a tree node
The issue is valid for Windows 7 and Windows 8 based devices and related to accessibility objects support in our suite
When I execute TreeView.SelectedNodes.Clear() during runtime, the SelctedNodeChanged event is not fired letting me know that the current selected node was changed to no selection. Should that qualify for a selection change event? Eessentially, the selected node has changed, but to no selection. The SelectedNodeChanging event does not fire as well. What event will let me know that a selection has been removed (changed)?
When you clear the child nodes of any node, the RadTreeView is scrolling to its initial position.
ADD. RadTreeView - add drag and drop functionality in bound mode too
Allow drag and drop of RadTreeView's nodes in bound mode
RadTreeView - export, print content possible supported file types: pdf, excel, html
Workaround: private void radTreeView1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { e.NodeElement.ContentElement.TextAlignment = ContentAlignment.MiddleCenter; }
To reproduce: Add some nodes to a tree, and then clear them and move them to another tree. The inner nodes expand/collapse does not work correctly: void radButton1_Click(object sender, EventArgs e) { tree1.Nodes.Clear(); tree2.Nodes.AddRange(nodes); } RadTreeView tree1 = new RadTreeView(); RadTreeView tree2 = new RadTreeView(); List<RadTreeNode> nodes = new List<RadTreeNode>(); private void Populate(RadTreeView tree) { RadTreeNode n11 = new RadTreeNode("11"); RadTreeNode n12 = new RadTreeNode("12"); RadTreeNode n13 = new RadTreeNode("13"); RadTreeNode n14 = new RadTreeNode("14"); nodes.Add(n11); nodes.Add(n12); nodes.Add(n13); nodes.Add(n14); RadTreeNode n21 = new RadTreeNode("21"); RadTreeNode n22 = new RadTreeNode("22"); RadTreeNode n23 = new RadTreeNode("23"); RadTreeNode n24 = new RadTreeNode("24"); n11.Nodes.Add(n21); n11.Nodes.Add(n22); n11.Nodes.Add(n23); n11.Nodes.Add(n24); RadTreeNode n31 = new RadTreeNode("31"); RadTreeNode n32 = new RadTreeNode("32"); RadTreeNode n33 = new RadTreeNode("33"); RadTreeNode n34 = new RadTreeNode("34"); n21.Nodes.Add(n31); n21.Nodes.Add(n32); n21.Nodes.Add(n33); n21.Nodes.Add(n34); tree.Nodes.AddRange(nodes); } 1. Run 2. Expand all nodes in tree1 3. Select node 23 4. Press button move right 5. Click at "plus" at node 21. -> expand collapse does not work correctly Workaround - instead of calling the Clear method of the Nodes collection, remove them manually: while (tree1.Nodes.Count > 0) { tree1.Nodes.RemoveAt(0); }
Step to reproduce: radTreeView1.Nodes["Random Node"].Enabled = false; WORKAROUND: public partial class Form1 : Form { public Form1() { InitializeComponent(); radTreeView1.CreateNodeElement += radTreeView1_CreateNodeElement; } void radTreeView1_CreateNodeElement(object sender, Telerik.WinControls.UI.CreateTreeNodeElementEventArgs e) { e.NodeElement = new MyTreeNodeElement(); } } public class MyTreeNodeElement : TreeNodeElement { protected override Type ThemeEffectiveType { get { return typeof(TreeNodeElement); } } protected override void InitializeFields() { base.InitializeFields(); this.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; } }
Steps to reproduce: public partial class Form3 : Form { private RadTreeView treeView = new RadTreeView(); private BindingSource bindingSource = new BindingSource(); private BindingSource bindingSource2 = new BindingSource();
FIX. RadTreeView - the text of disabled nodes is not aligned correctly
Hi there
I found this issue in RadTreeView filtering
I have a 2-level text structure programmatically created
after creation I use the command
radtree.ExpandAll()
This is the only event handled
Private Sub txtFilter_TextChanged(sender As Object, e As EventArgs) Handles txtFilter.TextChanged
radtreeNavigazione.Filter = txtFilter.Text
End Sub
When I set a filter with at least 4 letters and then I select the text in the filter box and press "back", the app freezes with cpu working at 50 %.
I use this workaround to solve
Private Sub txtFilter_TextChanged(sender As Object, e As EventArgs) Handles txtFilter.TextChanged
radtreeNavigazione.Filter = txtFilter.Text
End Sub
I use this workaround
Private Sub txtFilter_TextChanged(sender As Object, e As EventArgs) Handles txtFilter.TextChanged
radtree.CollapseAll()
radtreeNavigazione.Filter = txtFilter.Text
radtree.ExpandAll()
End Sub
In this way it works, but I wanted to report the issue.
Thank you in advance for your attention
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
How to reproduce: public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { radTreeView1.CheckBoxes = true; radTreeView1.TriStateMode = true; var rootNode = new RadTreeNode("Root Node"); radTreeView1.Nodes.Add(rootNode); // Create two parent nodes var parentNode1 = new RadTreeNode("First Parent"); var parentNode2 = new RadTreeNode("Second Parent"); // Add the parent nodes to tree view's nodes collection rootNode.Nodes.AddRange(parentNode1, parentNode2); // Create a child node var radTreeNodes2 = new List<RadTreeNode> { new RadTreeNode("nA.1"), new RadTreeNode("nB.2"), new RadTreeNode("nC.3"), new RadTreeNode("nD.4"), new RadTreeNode("nE.5"), }; var radTreeNodes = new List<RadTreeNode> { new RadTreeNode("nA.1"), new RadTreeNode("nB.2"), new RadTreeNode("nC.3"), new RadTreeNode("nD.4"), new RadTreeNode("nE.5"), }; // Add the child node to the first parent's nodes collection parentNode1.Nodes.AddRange(radTreeNodes); // Remove the child from the first parent collection and add it to the second parent nodes collection //parentNode1.Nodes.Remove(childNode); parentNode2.Nodes.AddRange(radTreeNodes2); rootNode.ExpandAll(); rootNode.Checked = true; } private void textBox1_TextChanged(object sender, EventArgs e) { radTreeView1.Filter = textBox1.Text; if(radTreeView1.TopNode != null) radTreeView1.TopNode.ExpandAll(); } }
Improve the drag and drop indicators by giving more clean user friendly design and positioning.
RadTreeView - Traverser throws exception if you clear and recreate all sub nodes of some node. Steps to reproduce: 1. Create RadTreeView with one node. 2. Add 100 sub nodes. 3. Clear the sub nodes. 4. Move scroll. WorkAround: private void RefreshNodes() { radTreeView1.BeginUpdate(); this.radTreeView1.TreeViewElement.Scroller.Traverser.Position = groupNode; this.radTreeView1.TreeViewElement.Scroller.Traverser.Reset(); this.radTreeView1.SelectedNodes.Clear(); groupNode.Nodes.Clear(); AddNodes(groupNode.Nodes, 1, 100); groupNode.Expand(); radTreeView1.EndUpdate(); this.radTreeView1.TreeViewElement.Update(RadTreeViewElement.UpdateActions.Reset); }