In this particular case, the control is populated with 100 000. When all items are selected and we click on a single note all other items will be de-selected. This operation takes more time than expected. The de-selection process must be improved.
Use the following code snippet and compare the filtering performance when using bound and unbound mode:
public RadForm1()
{
InitializeComponent();
this.radTextBox1.TextChanged += this.RadTextBox1_TextChanged;
this.radTextBox2.TextChanged += this.RadTextBox2_TextChanged;
List<Data> list = new List<Data>();
this.radTreeView1.BeginUpdate();
for (int i = 0; i < 100000; i++)
{
list.Add(new Data()
{
Id = i,
Name = "MyData_"+i,
ParentId = -1
}) ;
this.radTreeView1.Nodes.Add("MyData_"+i);
}
this.radTreeView1.EndUpdate();
this.radTreeView2.DisplayMember = "Name";
this.radTreeView2.ParentMember = "ParentId";
this.radTreeView2.DataSource = list;
}
private void RadTextBox2_TextChanged(object sender, EventArgs e)
{
this.radTreeView2.Filter = this.radTextBox2.Text;
}
private void RadTextBox1_TextChanged(object sender, EventArgs e)
{
this.radTreeView1.Filter = this.radTextBox1.Text;
}
}
public class Data
{
public int Id { get; set; }
public string Name { get; set; }
public int ParentId { get; set; }
}
Expected behavior: the performance in bound and unbound mode should be quite similar
Actual behavior: the performance is much slower in bound mode
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.
Add a RadTreeView and fill it with nodes so that a vertical scrollbar is shown.
The RadTreeView.TopNode property indicates that it is expected to return the RadTreeNode which visual node element is the first visible one in the current view. But it always return the first data node in RadTreeView no matter which node is currently visible at the top. This is because it consider the RadTreeNode.Visible property.
Workaround:
TreeNodeElement neFirstVisible = this.radTreeView1.TreeViewElement.ViewElement.Children[0] as TreeNodeElement;
RadMessageBox.Show("TopNode = " + neFirstVisible.Data.Text);
Add a CodedUI test which records expanding a node in RadTreeView. Run the CodedUI test and you will see that the TestMethod throws the following exception:
"Microsoft.VisualStudio.TestTools.Extension.UITestControlNotFoundException: The playback failed to find the control with given search properties."
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; }
Workaround: Expand and collapse the nodes so that they are synchronized this.radTreeView1.ExpandAll(); this.radTreeView1.CollapseAll();
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); }
Say you have a button which clears the old nodes and adds a number of new child nodes to the currently selected node. If the selected node is collapsed, the newly added nodes are not visible but the scrollbar updates as if they were. Workaround the issue by using the BeginUpdate/EndUpdate methods of RadTreeView when updating the nodes: radTreeView1.BeginUpdate(); node.Nodes.Clear(); foreach (RadTreeNode treeNode in nodes) { node.Nodes.Add((RadTreeNode)treeNode.Clone()); } radTreeView1.EndUpdate();
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.
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.
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.