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.
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
To reproduce: add several nodes at design time in order to obtain a vertical scrollbar. Enable the drag and drop functionality by setting the AllowDragDrop property to true. If you start dragging you will notice that the RadTreeView doesn't auto-scroll when you drag close to the borders of the visible area. Workaround: Class CustomDragDropService Inherits TreeViewDragDropService Public Sub New(ByVal owner As RadTreeViewElement) MyBase.New(owner) End Sub Protected Overrides Sub SetHintWindowPosition(ByVal mousePt As Point) End Sub End Class Class CustomTreeViewElement Inherits RadTreeViewElement Protected Overrides ReadOnly Property ThemeEffectiveType As Type Get Return GetType(RadTreeViewElement) End Get End Property Protected Overrides Function CreateDragDropService() As TreeViewDragDropService Return New CustomDragDropService(Me) End Function End Class Class CustomTreeView Inherits RadTreeView Protected Overrides Function CreateTreeViewElement() As RadTreeViewElement Return New CustomTreeViewElement() End Function Public Overrides Property ThemeClassName As String Get Return GetType(RadTreeView).FullName End Get Set(value As String) MyBase.ThemeClassName = value End Set End Property End Class
To reproduce: please refer to the attached project. Workaround: if you access the RadTreeNode.TreeViewElement property, the TreeView property is loaded.
Workaround: call the ExpandAll method of the tree removing any nodes
When you start dragging a node you will notice that the drag hint is constantly flickering.
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); } }
To reproduce: - add a RadTreeView - enable multiselect - select at least 1 node - call radTreeView1.SelectedNodes.Clear() Workaround: Clear the nodes manually: foreach (var node in this.radTreeView1.SelectedNodes.ToList()) { node.Selected = false; }
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; } }
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; }
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; }
To reproduce: radTreeView1.Filter = "new"; var node = new RadTreeNode( "test" ); radTreeView1.Nodes.Add( node ); //here the node is not in the Nodes collection if ( radTreeView1.Nodes.Contains( node ) == false ) { radTreeView1.Nodes.Add( new RadTreeNode( "test" ) ); } Workaround: remove the filter, perform the desired check and restore the filter
Scenario: We have an object P which has two lists of child objects of types C1 and C2. If we create a list of P and we try to bind the tree to this list and display the two lists as child nodes, we will not succeed.
Private Sub LoadTvObjectInApp() Dim objectInApps As IQueryable(Of ObjectInApp) objectInApps = _context.ObjectInApps.Where(Function(c) (c.ApplicatieCode = "zis") AndAlso Not (c.GroepNaam = "hulp" AndAlso c.IsSysteemObject = True))
Sort the selected nodes according to their position in the tree
RadTreeView. Add node templates as ASP.NET AJAX - http://www.telerik.com/help/aspnet-ajax/treeview-templates-structure.html
I need to drop a simple plain text from a textbox into a Rad Treeview. I just read the forum, I'm mixing OLE Drag & Drop and RadTreeView Drag & Drop. The Events seems to be right and they seems to work fine. But I'm just having a problem with the Visual Indicators of the treeview: When I drag a regular node inside the treeview, I can see that visual indicators (the target node is highlighted, I can see a line of dots showing the direction above or below the target node, or the "forbidden" cursor, etc). And when I actually try to drag a simple text inside the treeview, I don't see any of those stuff. I need the same visual behavior when dropping a simple text. I need to see the indicators and I don't know how to activate them.