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: 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 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.
To reproduce: private void RadTreeView1_NodeCheckedChanging(object sender, Telerik.WinControls.UI.RadTreeViewCancelEventArgs e) { Console.WriteLine(e.Action); } The action is always unknown.
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.
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; } }
For the MS TreeView the HideSelection property gets or sets a value indicating whether the selected tree node remains highlighted even when the tree view has lost the focus. However, it doesn't work in RadTreeView.
When you start dragging a node you will notice that the drag hint is constantly flickering.
To reproduce: please refer to the attached gif files with the different versions of the Telerik UI for WinForms suite . You will notice that while you are dragging a node the default cursor is an arrow with a small rectangle. If you hold the Ctrl key pressed while dragging the node, the default cursor is an arrow with a small rectangle and '+'. With the latest version, the '+' sign is missing when you hold the Ctrl key.
To reproduce: please refer to the attached project. Workaround: if you access the RadTreeNode.TreeViewElement property, the TreeView property is loaded.
To reproduce: add some nodes to the tree view at design time public RadForm1() { InitializeComponent(); this.radTreeView1.AllowDragDrop = true; this.radTreeView1.DragEnding += radTreeView1_DragEnding; } private void radTreeView1_DragEnding(object sender, Telerik.WinControls.UI.RadTreeViewDragCancelEventArgs e) { if (MessageBox.Show("Are you sure you want to move?", "Question", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { e.Cancel = true; } } Then try to drag and drop a node. You will notice that the application hangs Workaround: use RadMessageBox
At the moment the filter predicate is called only for the root nodes. A possible workaround is to recursively apply the filter logic for the child nodes as well. Workaround: private void Button1_Click(object sender, EventArgs e) { this.radTreeView1.TreeViewElement.FilterPredicate = this.FilterNode; this.radTreeView1.Filter = "Custom"; } private bool FilterNode(RadTreeNode node) { Console.WriteLine(node.Text); if (node.Text.Contains("Child: 3")) { return true; } Stack<RadTreeNode> children = new Stack<RadTreeNode>(); if (node.Nodes.Count > 0) { children.Push(node); while (children.Count > 0) { RadTreeNode current = children.Pop(); foreach (RadTreeNode child in current.Nodes) { if (child.Text.Contains("Child: 3")) { return true; } children.Push(child); } } } return false; }
Workaround: private void radButton1_Click(object sender, EventArgs e) { var allNodes = radTreeView1.TreeViewElement.GetNodes().ToList(); int row = 0; Workbook workbook = new Workbook(); Worksheet newWorksheet = workbook.Worksheets.Add(); foreach (var item in allNodes) { CellSelection cell = newWorksheet.Cells[row, item.Level]; cell.SetValue(item.Text); cell = newWorksheet.Cells[row++, 2]; cell.SetValue(item.Checked); } var formatProvider = new XlsxFormatProvider(); var bytes = formatProvider.Export(workbook); File.WriteAllBytes(@"D:\Test.xlsx", bytes); }
To reproduce: please refer to the attached sample project and try to reorder a node. You will notice that the message box is not rendered properly. //case 2 private void DragDropService_PreviewDragDrop(object sender, RadDropEventArgs e) { e.Handled = true; RadMessageBox.Show(this, "Showing a messagebox under dragending doesn't work correctly."); } //case 1 private void radTreeView1_DragEnding(object sender, Telerik.WinControls.UI.RadTreeViewDragCancelEventArgs e) { //e.Cancel = true; //RadMessageBox.Show(this, "Showing a messagebox under dragending doesn't work correctly."); } Workaround: subscribe to the TreeViewElement.DragDropService.PreviewDragDrop and set the Handled argument to true if you want to cancel the drop operation. Then, handle the TreeViewElement.DragDropService.Stopped event and show the desired message. public Form1() { InitializeComponent(); this.radTreeView1.TreeViewElement.DragDropService.PreviewDragDrop += DragDropService_PreviewDragDrop; this.radTreeView1.TreeViewElement.DragDropService.Stopped+=DragDropService_Stopped; } private void DragDropService_Stopped(object sender, EventArgs e) { RadMessageBox.Show(this, "Showing a messagebox under dragending doesn't work correctly."); } private void DragDropService_PreviewDragDrop(object sender, RadDropEventArgs e) { e.Handled = true; }
To reproduce: Run the attached application. Drag Node 2 to after Node 4 while holding down the Alt key. Note that the Node 2 copy is inserted before Node 4. When Node 2 is dragged to after Node 4 without holding down the Alt key, Node 2 is correctly moved to after Node 4. Workaround: you can modify the TreeViewDragDropService and control at what position exactly to be inserted the dragged node: https://docs.telerik.com/devtools/winforms/treeview/drag-and-drop/modify-the-dragdropservice-behavior https://docs.telerik.com/devtools/winforms/treeview/drag-and-drop/drag-and-drop-in-bound-mode
To reproduce: add a RadTreeView and a RadBreadCrumb and apply the MaterialTeal theme. Refer to the attached screenshot illustrating the wrong font of the selected item. Workaround: public partial class RadForm1 : Telerik.WinControls.UI.RadForm { public RadForm1() { InitializeComponent(); ThemeResolutionService.ApplicationThemeName = "MaterialTeal"; this.radTreeView1.NodeFormatting += radTreeView1_NodeFormatting; this.radTreeView1.SelectedNodeChanged += radTreeView1_SelectedNodeChanged; } private void UpdateFont() { foreach (RadSplitButtonElement item in this.radBreadCrumb1.BreadCrumbElement.Items) { foreach (RadMenuItem menuItem in item.Items) { if (this.radTreeView1.SelectedNode != null && menuItem.Text == this.radTreeView1.SelectedNode.Text) { menuItem.Font = new Font(f.FontFamily,f.Size, FontStyle.Bold); } } } } private void radTreeView1_SelectedNodeChanged(object sender, Telerik.WinControls.UI.RadTreeViewEventArgs e) { UpdateFont(); } Font f = null; private void radTreeView1_NodeFormatting(object sender, Telerik.WinControls.UI.TreeNodeFormattingEventArgs e) { f = e.NodeElement.ContentElement.Font; }
Hi there, through out our app we use the treeview everywhere - but we have had this issue where it crashes when someone right clicks on the treeview where there is no node. This crash happens on the "ContextMenuOpening" event when we try to use e.TreeElement. This is because, on the telerik side of things, the getter for that property is throwing a NullReferenceException (see attached screenshot)
I think this is happening because in your RadTreeViewCancelEventArgs.cs it is this:
public RadTreeViewElement TreeElement
{
get { return node.TreeViewElement; }
}
public RadTreeView TreeView
{
get { return node.TreeView; }
}
But since node == null, it throws the exception. It probably should check for null, and if node is null, return a null for those properties - so we can use null conditional operator to check stuff. We have a workaround but it is just lots of copy and paste of things.
Afternoon
We have a RadTReeView that we drag nodes around to reorder within the same treeview.
There are about 2000 nodes in the tree that is a self referencing data bound and goes about 15 levels deep at some parts of the tree
When we click left mouse down (keeping it down) to drag and drop reorder a node, using the mouse wheel to scroll the tree up or down does not work anymore
We want to for instance drag a node from a location to another location outside the current view, using the mouse wheel to navigate the tree view up and down. This used to work, but not after upgrading to the new 2019 telerik.
Is there a tree view control option that needs to be toggled for this to work?
Thank you
Theo
Hi all,
RadTreeView is very nice control , For treeline we can give line style, color but we can't set line thickness,
I want to change thickness of Treeline can you guide me how to do it?
Hi All,
I have made User control for custom node, in this user control i have used following controls
1 RadLabel (no of control - 3)
2 RadPanel (no of control -1)
3 PictureBox (no of Control - 4 )
4 TableLayoutPanel (no of control -3)
Means i have used total 11 controls within my user control.
Height of usercontrol = 146
Width of Usercontrol = 595
I have taken RadTreeView and above UserControl added as Node,following properties of treeview is set
this.radTreeView1.DataSource = Staff.GetStaff();
this.radTreeView1.ParentMember = "ParentID";
this.radTreeView1.ChildMember = "ID";
this.radTreeView1.DisplayMember = "Department";
this.radTreeView1.CreateNodeElement += this.OnCreateNodeElement;
this.radTreeView1.TreeViewElement.AutoSizeItems = true;
this.radTreeView1.ShowRootLines = false;
this.radTreeView1.FullRowSelect = false;
this.radTreeView1.ShowLines = true;
this.radTreeView1.LineStyle = TreeLineStyle.Solid;
this.radTreeView1.LineColor = Color.FromArgb(110, 153, 210);
this.radTreeView1.TreeIndent = 50;
this.radTreeView1.ExpandAll();
But when i run the code it shows like this means my control is not displaying and the property "AutoSizeItems" is not working.
hope for quick reply