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
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.
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.
Repro-steps:
Observed behavior:
Expected behavior:
Remove operation not work in sorted unbound treeview
In Load-On-Demand scenario when visibility of ExpanderElement is changed in NodeFormatting - drawing of lines is invalid
In self-reference mode you can not have root Nodes with different ID's
When I try to build a sample application to repro it works fine everytime, except in my main application. In this one it constantly goes wrong. GetNodeByPath works only when I search for the rootnode, for every other child node it returns 'nothing'.
add / remove / clear from RadTreeView control or external source
Setting this before the tree is drawn generates a StackOverflowException. If you leave this commented out, and set this property on Form Load, the tree will appear and function correctly. If however you then add a node, the same exception appears.
TreeViewDragDropService cannot be canceled on the following event: radTreeView1.TreeViewElement.DragDropService.PreviewDragOver
Unable to add a Node when RadTreeView is sorted - Please, refer to QSF->PivotGrid->Settings example and click twice on the Product filter to open the filter dialog.
The Enabled property cannot be set in PropertyBuild if the RadTreeView is already data-binded via Property builder Workaround: Set the property at run-time.
Currently, when a node is checked its parent/child nodes are checked accordingly and for each node that has its checked state changed the NodeCheckedChanged is fired. However, there is not way to know whether the event is fired because of manual user action on the node (clicking the checkbox, pressing Space/Enter keys) or because the node is in parent/child relation with the 'clicked' node. So, event arguments about that should be added.
If you hide a node using the advanced builder go to an other node and they try to get back to the first node, you will notice that you will not be able to do so.
ADD SaveXML and LoadXML method of RadTreeView that allows loading and saving xml via stream
Add TreeViewXml property to RadTreeView that allows xml serialization by string type