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.
To reproduce: private void RadTreeView1_NodeCheckedChanging(object sender, Telerik.WinControls.UI.RadTreeViewCancelEventArgs e) { Console.WriteLine(e.Action); } The action is always unknown.
To reproduce: public RadForm1() { InitializeComponent(); for (int i = 0; i < 10; i++) { this.radTreeView1.Nodes.Add("Node1." + i); } this.radTreeView1.AllowDragDrop = true; this.radTreeView1.TreeViewElement.DragDropService.PreviewDragDrop+=DragDropService_PreviewDragDrop; } private void DragDropService_PreviewDragDrop(object sender, RadDropEventArgs e) { e.Handled = true; }
To reproduce: for (int i = 0; i < 10; i++) { this.radTreeView1.Nodes.Add("Node1." + i); } this.radTreeView1.AllowDragDrop = true; this.radTreeView1.TreeViewElement.DragDropService.ShowDragHint = false; Workaround: this.radTreeView1.TreeViewElement.DragDropService.PreviewDragHint += DragDropService_PreviewDragHint; private void DragDropService_PreviewDragHint(object sender, PreviewDragHintEventArgs e) { e.UseDefaultHint = false; }
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.
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(); } }
To reproduce: please refer to the attached gif file. Workaround: insteda of hiding the expander by the ShowExpandCollapse property use the NodeFormatting event as follows: private void radTreeView1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { e.NodeElement.ExpanderElement.Visibility = ElementVisibility.Collapsed; }
Please refer to the attached screenshot from the Demo application >> General Settings example. Workaround: private void radTreeView1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { e.NodeElement.ExpanderElement.Margin = new Padding(2, 0, 0, 0); }
To reproduce: this.radTreeView1.TriStateMode = true; RadTreeNode sitesNode = radTreeView1.Nodes.Add("Sites", "Sites", ""); sitesNode.Expanded = true; RadTreeNode siteNode = new RadTreeNode("A site"); sitesNode.Nodes.Add(siteNode); RadTreeNode eNode = new RadTreeNode("Event Types"); siteNode.Nodes.Add(eNode); siteNode.Expanded = true; RadTreeNode dummy = new RadTreeNode("dummy"); eNode.Nodes.Add(dummy); dummy.CheckState = ToggleState.On; RadTreeNode dummy2 = new RadTreeNode("dummy2"); eNode.Nodes.Add(dummy2); dummy2.CheckState = ToggleState.Off; Please refer to the attached screenshot. Workaround: change the CheckState property after all nodes are added to RadTreeView. this.radTreeView1.TriStateMode = true; RadTreeNode sitesNode = radTreeView1.Nodes.Add("Sites", "Sites", ""); sitesNode.Expanded = true; RadTreeNode siteNode = new RadTreeNode("A site"); sitesNode.Nodes.Add(siteNode); RadTreeNode eNode = new RadTreeNode("Event Types"); siteNode.Nodes.Add(eNode); siteNode.Expanded = true; RadTreeNode dummy = new RadTreeNode("dummy"); eNode.Nodes.Add(dummy); RadTreeNode dummy2 = new RadTreeNode("dummy2"); eNode.Nodes.Add(dummy2); dummy2.CheckState = ToggleState.Off; dummy.CheckState = ToggleState.On;
To reproduce: Add a RadTreeView and a RadBreadCrumb and two RadButtons on the form and populate the tree view with data. Use the following code snippet: private void radButton1_Click(object sender, EventArgs e) { this.radBreadCrumb1.DefaultTreeView = null; } Random rand = new Random(); private void radButton2_Click(object sender, EventArgs e) { this.radTreeView1.DataSource = null; DataTable dt = new DataTable(); dt.Columns.Add("Id"); dt.Columns.Add("Name"); for (int i = 0; i < 10; i++) { dt.Rows.Add(rand.Next(0, 20), "Node" + i); } this.radTreeView1.DataSource = dt; this.radTreeView1.DisplayMember = "Name"; this.radTreeView1.ValueMember = "Id"; this.radBreadCrumb1.DefaultTreeView = this.radTreeView1; } Select some node in RadTreeView, the RadBreadCrum is updated respectively. Then click the first button to detach RadTreeView from RadBreadCrumb. Click the second button to populate RadTreeView with new data and associated the RadBreadCrumb with RadTreeView again. As a result you will notice that the last selected node will be loaded. Workaround: clear the selection in RadTreeView before associating the RadBreadCrumb with RadTreeView: this.radTreeView1.ClearSelection(); this.radBreadCrumb1.DefaultTreeView = this.radTreeView1;
To reproduce: 1. Add a RadTreeView and a RadBreadCrumb. Associated the breadcrumb with the tree. 2. Select a node and use the following code: this.radBreadCrumb1.DefaultTreeView.Nodes.Clear(); Workaround: set the RadBreadCrumb.DefaultTreeView property to null.
Steps to reproduce: 1. Add RadTreeView with few items 2. Apply custom filtering 3. In order to remove the custom filtering and return the default filtering, set the FilterPredicate to null. As a result, it is thrown an exception. Workaround: 1. Save the default filter predicate before applying the custom filtering 2. Clear filter descriptors and set the FilterPredicate property to stored default filter predicate In the attachments can be found a sample application demonstrating the issue and the workaround
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.
Please refer to the attached sample project and follow the steps: If you execute my code sample and try this sequence, you will see my problem: 1- start the application 2- select "test1" on the grid => you see "fonction XX of test1" in the treeview (that's correct) 3- select "test2" on the grid => you see "fonction XX of test2" in the treeview (that's correct) 4- expand all nodes in the treeview 5- uncheck "fonction 31 of test2" in the treeview 6- select "test1" on the grid => you have the error message. On the grid, we have "test1" selected and on the treeview we have "test2". Note that the problem appears only when checking a node in the treeview on a second level. If you follow this procedure, you will have no problem : 1- restart the application 2- select "test1" on the grid => you see "fonction XX of test1" in the treeview (that's correct) 3- select "test2" on the grid => you see "fonction XX of test2" in the treeview (that's correct) 4- uncheck "fonction 30 of test2" in the treeview 5- select "test1" on the grid => you will have no error. On the grid, we have "test1" selected and on the treeview we have "test1". 6- select "test2" on the grid => you will have no error. On the grid, we have "test2" selected and on the treeview we have "test2" with "fonction 30 of test2" unchecked. Workaround: in order to synchronize the current row in RadGridView is to change the RadTreeView.DataSource in the RadGridView.CurrentRowChanged event.
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); } }
Workaround: raise a flag before the delete operation and cancel the SelectedNodeChanging event
Use the attached project to reproduce. - Check on of the nodes and then press Alt +T (do not move the mouse away from the node) Workaround: Set transparent fill and border to the TreeNodeElement disabled state in Visual Style Builder.
To reproduce: select a node and click the button. Note: it may be necessary to perform this several times. public partial class Form1 : Form { public Form1() { InitializeComponent(); } private List<DataObject> GetDataList() { var ret = new List<DataObject>(); ret.Add(new DataObject() { Node = "A", Parent = null }); ret.Add(new DataObject() { Node = "B", Parent = "A" }); ret.Add(new DataObject() { Node = "C", Parent = "B" }); ret.Add(new DataObject() { Node = "D", Parent = "B" }); return ret; } private void button1_Click(object sender, EventArgs e) { radTreeView1.Nodes.Clear(); radTreeView1.DisplayMember = "Node"; radTreeView1.ChildMember = "Node"; radTreeView1.ParentMember = "Parent"; radTreeView1.DataSource = GetDataList(); radTreeView1.ExpandAll(); } } public class DataObject { public string Node { get; set; } public string Parent { get; set; } } Workaround: instead of clearing the nodes, set the DataSource property to null.
Workaround: this.radTreeView1.TreeViewElement.InvalidateMeasure(); this.radTreeView1.TreeViewElement.InvalidateArrange();
To reproduce: - Open the attached project. - Scroll to the right. - Drag a node. - The DropHint line is outside the window. Workaround: class CustomTreeView : RadTreeView { //Replace the default element with the custom one protected override RadTreeViewElement CreateTreeViewElement() { return new CustomTreeViewElement(); } //Enable theming for the control public override string ThemeClassName { get { return typeof(RadTreeView).FullName; } } } class CustomTreeViewElement : RadTreeViewElement { //Enable themeing for the element protected override Type ThemeEffectiveType { get { return typeof(RadTreeViewElement); } } //Replace the default drag drop service with the custom one protected override TreeViewDragDropService CreateDragDropService() { return new MyDragDropService(this); } } class MyDragDropService : TreeViewDragDropService { public MyDragDropService(RadTreeViewElement owner) : base(owner) { } protected override void UpdateHintPosition(Point mousePosition) { base.UpdateHintPosition(mousePosition); RadLayeredWindow dropHint =typeof(TreeViewDragDropService).GetField("dropHintWindow", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(this) as RadLayeredWindow; if (dropHint != null) { TreeNodeElement nodeElement = this.DropTarget as TreeNodeElement; dropHint.Location = new Point (nodeElement.ElementTree.Control.PointToScreen(Point.Empty).X, dropHint.Location.Y); } } }