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?
Workaround: Instead of {RadTreeNode}.Nodes.Clear(), use while ({RadTreeNode}.Nodes.Count>0) { {RadTreeNode}.Nodes.RemoveAt(0); }
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
Please run the attached sample project and follow the steps illustrated in the gif file. You will notice the following behavior:
If you select multiple items/nodes and then right click on the last selected item/node, the context menu comes up as expected and multiple selection is kept. But if you right click on any other item/node that is selected,the selected nodes become unselected and only the node you are over becomes selected.
The multiple selection is kept in Windows Explorer and VS Solution explorer wne you right click over an already selected node.
Workaround:
public RadForm1()
{
InitializeComponent();
this.radTreeView1.MultiSelect = true;
this.radTreeView1.AllowDefaultContextMenu = true;
}
class CustomTreeViewElement : RadTreeViewElement
{
protected override Type ThemeEffectiveType
{
get
{
return typeof(RadTreeViewElement);
}
}
protected override bool ProcessMouseDown(MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
RadContextMenu menu = this.ContextMenu;
RadTreeNode node = this.GetNodeAt(e.Location);
if (node!=null)
{
node.Selected = true;
}
if (node != null && node.ContextMenu != null)
{
menu = node.ContextMenu;
}
if (menu == null && this.AllowDefaultContextMenu)
{
menu = this.InitializeDefaultContextMenu(node);
}
if (menu != null)
{
RadControl parentControl = (this.ElementTree.Control as RadControl);
if (parentControl != null)
{
menu.ThemeName = parentControl.ThemeName;
menu.DropDown.RightToLeft = parentControl.RightToLeft;
}
TreeViewContextMenuOpeningEventArgs args = new TreeViewContextMenuOpeningEventArgs(node, menu, this);
OnContextMenuOpening(args);
if (!args.Cancel)
{
menu.Show(this.ElementTree.Control, e.Location);
return true;
};
}
}
return base.ProcessMouseDown(e);
}
}
class CustomTreeView : RadTreeView
{
protected override RadTreeViewElement CreateTreeViewElement()
{
return new CustomTreeViewElement();
}
public override string ThemeClassName
{
get
{
return typeof(RadTreeView).FullName;
}
}
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case 0x7b:
return;
}
base.WndProc(ref m);
}
}
Hi,
on the Winform Demo application, go to the TreeView demos, and selection "Selection".
1) select the "Folders" item listed under the "Inbox" item.
2) Collapse the "Inbox" item by clicking the ARROW next to the "Inbox"
3) Hold down the SHIFT key and left-mouse click on the "Outbox" item, you end up with a selection all the way up the tree to the ROOT element
Sort the selected nodes according to their position in the tree
Please refer to the attached sample project and try to edit a node. In random situations the Node argument in the Edited event is null or points to a wrong data node:
1. Start WinAppDriver.exe
2. Open the attached sample solution
3. Click "Run all" tests
You will see that the test will not be able to locate any RadTreeNode elements located outside of the first parent node collection. Note that the test uses "FindElementByName("name")" method.
1. Place a RadTreeView in a form and add enough items to show scrollbars; 2. Show the form using ShowDialog() and close it 3. Open it again and note that there are no scrollbars in the RadTreeView
The following code produces an error when the user attempts to edit the root node: DataTable dt = new DataTable(); DataColumn column = new DataColumn("ID", typeof(int)); column.AllowDBNull = false; column.AutoIncrement = true; dt.Columns.Add(column); dt.Columns.Add(new DataColumn("ParentID", typeof(int))); dt.Columns.Add(new DataColumn("Name", typeof(string))); dt.Columns.Add(new DataColumn("Note", typeof(string))); dt.Rows.Add(1, DBNull.Value, "Root", "Note1"); dt.Rows.Add(2, 1, "First", "Note1"); dt.Rows.Add(3, 1, "Second", "Note1"); dt.Rows.Add(4, 3, "Third", "Note1"); this.radTreeView1.DisplayMember = "Name"; this.radTreeView1.ParentMember = "ParentID"; this.radTreeView1.ChildMember = "ID"; this.radTreeView1.ValueMember = "ID"; this.radTreeView1.DataSource = dt; radTreeView1.TreeViewElement.EditMode = TreeNodeEditMode.Text; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Telerik.WinControls.UI; namespace Lab.Tree { public partial class TreeSelfreferenceEditRootNodeForm : Form { private RadTreeView treeView = new RadTreeView(); private BindingSource bindingSource = new BindingSource(); public TreeSelfreferenceEditRootNodeForm() { InitializeComponent(); treeView.Dock = DockStyle.Fill; treeView.Parent = this; treeView.AllowEdit = true; DataTable dt = new DataTable(); DataColumn column = new DataColumn("ID", typeof(int)); column.AllowDBNull = false; column.AutoIncrement = true; dt.Columns.Add(column); dt.Columns.Add(new DataColumn("ParentID", typeof(int))); dt.Columns.Add(new DataColumn("Name", typeof(string))); dt.Columns.Add(new DataColumn("Note", typeof(string))); dt.Rows.Add(1, DBNull.Value, "Root", "Note1"); dt.Rows.Add(2, 1, "First", "Note1"); dt.Rows.Add(3, 1, "Second", "Note1"); dt.Rows.Add(4, 3, "Third", "Note1"); bindingSource.DataSource = dt; treeView.DisplayMember = "Name"; treeView.ParentMember = "ParentID"; treeView.ChildMember = "ID"; treeView.ValueMember = "ID"; treeView.DataSource = bindingSource; treeView.TreeViewElement.EditMode = TreeNodeEditMode.Text; } } }
SelectedNodeChanged event not owrk properly during remove operation of SelectedNode
When i have the root nodes loaded, but there are more nodes than fit in the visible area of the treeview, the scrollbar is not automatically shown. I've tried setting the AutoScroll option to true, but that doesn't help.
Repro-steps:
Observed behavior:
Expected behavior:
Steps to reproduce the issue:
1. Run the example app.
2. Click undo (the last item is removed).
3. Click redo (the last item should be added to the Treeview, it does not)
If I run the application and click undo twice and then redo twice, the things work. The Treeview is not updated if I add and remove the same element instance to the binding list.
Workaround: rebind the treeview after redo or create a new instance of the Element class with the same name and id.
NullReferenceException in the UpdateLines method somehow triggered by the OnProcessMouseUp handler, when I'm trying to perform a drag and drop move in my treeview, that is fully managed by an inner model. The DnD events are bound and trigger delete + add actions in the tree.
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
bind the tree and try to add a node to the control - error occurs
To reproduce: public Form1() { InitializeComponent(); DataTable table = new DataTable(); table.Columns.Add("ID"); table.Columns.Add("Name"); for (int i = 0; i < 10; i++) {