How to reproduce: public partial class RadForm1 : Telerik.WinControls.UI.RadForm { private BindingList<TreeViewDataObject> data; public static int Id = 0; public RadForm1() { InitializeComponent(); var theme = new FluentTheme(); ThemeResolutionService.ApplicationThemeName = theme.ThemeName; this.data = new BindingList<TreeViewDataObject>(); for (int i = 1; i <= 5; i += 1) { Id++; TreeViewDataObject root = new TreeViewDataObject() { Id = Id, ParentId = -1, Name = "Root: " + i }; this.data.Add(root); for (int j = 1; j <= 3; j++) { Id++; TreeViewDataObject child = new TreeViewDataObject() { Id = Id, ParentId = root.Id, Name = "Child: " + Id }; this.data.Add(child); for (int K = 1; K <= 5; K++) { Id++; TreeViewDataObject c = new TreeViewDataObject() { Id = Id, ParentId = child.Id, Name = "Child: " + Id }; this.data.Add(c); } } } this.radTreeView1.DataSource = this.data; this.radTreeView1.DisplayMember = "Name"; this.radTreeView1.ParentMember = "ParentId"; this.radTreeView1.ChildMember = "Id"; this.radTreeView1.RelationBindings.Add(new RelationBinding(this.data, "Name", "ParentId", "Id")); this.radTreeView1.ExpandAll(); this.radTreeView1.TreeViewElement.AllowEdit = true; this.radTreeView1.TreeViewElement.AllowAdd = true; this.radTreeView1.TreeViewElement.AllowRemove = true; } } public class TreeViewDataObject { public int Id { get; set; } public int ParentId { get; set; } public string Name { get; set; } } Workaround: Handle the ContextMenuOpening event and add logic for creating a new record in the data source object public partial class RadForm1 : Telerik.WinControls.UI.RadForm { private BindingList<TreeViewDataObject> data; private int id = 0; public RadForm1() { InitializeComponent(); var theme = new FluentTheme(); ThemeResolutionService.ApplicationThemeName = theme.ThemeName; this.data = new BindingList<TreeViewDataObject>(); for (int i = 1; i <= 5; i += 1) { id++; TreeViewDataObject root = new TreeViewDataObject() { Id = id, ParentId = -1, Name = "Root: " + i }; this.data.Add(root); for (int j = 1; j <= 3; j++) { id++; TreeViewDataObject child = new TreeViewDataObject() { Id = id, ParentId = root.Id, Name = "Child: " + id }; this.data.Add(child); for (int K = 1; K <= 5; K++) { id++; TreeViewDataObject c = new TreeViewDataObject() { Id = id, ParentId = child.Id, Name = "Child: " + id }; this.data.Add(c); } } } this.radTreeView1.DataSource = this.data; this.radTreeView1.DisplayMember = "Name"; this.radTreeView1.ParentMember = "ParentId"; this.radTreeView1.ChildMember = "id"; this.radTreeView1.RelationBindings.Add(new RelationBinding(this.data, "Name", "ParentId", "id")); this.radTreeView1.ExpandAll(); this.radTreeView1.ContextMenuOpening += RadTreeView1_ContextMenuOpening; this.radTreeView1.TreeViewElement.AllowEdit = true; this.radTreeView1.TreeViewElement.AllowAdd = true; this.radTreeView1.TreeViewElement.AllowRemove = true; } private void RadTreeView1_ContextMenuOpening(object sender, TreeViewContextMenuOpeningEventArgs e) { TreeViewDefaultContextMenu treeMenu = e.Menu as TreeViewDefaultContextMenu; treeMenu.Items.Remove(treeMenu.AddMenuItem); RadMenuItem item = new RadMenuItem("&New"); item.Click -= Item_Click; item.Click += Item_Click; treeMenu.Items.Insert(2, item); } private void Item_Click(object sender, EventArgs e) { RadTreeNode parent = this.radTreeView1.SelectedNode; if (parent == null || parent.DataBoundItem == null) { return; } this.id++; BindingList<TreeViewDataObject> data = this.radTreeView1.DataSource as BindingList<TreeViewDataObject>; TreeViewDataObject newObject = new TreeViewDataObject() { Id = this.id, ParentId = ((TreeViewDataObject)parent.DataBoundItem).Id, Name = "New Name" }; parent.Expanded = true; data.Add(newObject); } } public class TreeViewDataObject { public int Id { get; set; } public int ParentId { get; set; } public string Name { get; set; } }
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. - Add 100 nodes so the scroll appears. - Try scrolling to bottom. Workaround: radTreeView1.TreeViewElement.Scroller.ScrollMode = ItemScrollerScrollModes.Discrete;
Workaround: Expand and collapse the nodes so that they are synchronized this.radTreeView1.ExpandAll(); this.radTreeView1.CollapseAll();
To reproduce: use the following code snippet. You will notice that mnemonics are displayed. public RadForm1() { InitializeComponent(); new RadControlSpyForm().Show(); this.radTreeView1.DisplayMember = "name"; this.radTreeView1.ParentMember = "pid"; this.radTreeView1.ChildMember = "id"; this.radTreeView1.DataSource = this.GetSampleData(); this.radTreeView1.NodeFormatting += radTreeView1_NodeFormatting; this.radTreeView1.SelectedNodeChanged += radTreeView1_SelectedNodeChanged; this.radBreadCrumb1.DefaultTreeView = this.radTreeView1; } private void radTreeView1_SelectedNodeChanged(object sender, Telerik.WinControls.UI.RadTreeViewEventArgs e) { foreach (RadSplitButtonElement item in this.radBreadCrumb1.BreadCrumbElement.Items) { item.ActionButton.TextElement.UseMnemonic = false; } } private void radTreeView1_NodeFormatting(object sender, Telerik.WinControls.UI.TreeNodeFormattingEventArgs e) { e.NodeElement.ContentElement.UseMnemonic = false; } private DataTable GetSampleData() { DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dc.ColumnName = "id"; dc.DataType = typeof(int); dt.Columns.Add(dc); DataColumn dc1 = new DataColumn(); dc1.ColumnName = "name"; dc1.DataType = typeof(string); dt.Columns.Add(dc1); DataColumn dc2 = new DataColumn(); dc2.ColumnName = "pid"; dc2.DataType = typeof(int); dt.Columns.Add(dc2); DataRow dr = dt.NewRow(); dr[0] = 0; dr[1] = "Hello & Goodbye"; dr[2] = DBNull.Value; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = 1; dr[1] = @"&C:\"; dr[2] = 0; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = 2; dr[1] = @"&D:\"; dr[2] = 0; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = 3; dr[1] = "&Program Files"; dr[2] = 1; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = 4; dr[1] = "M&icrosoft"; dr[2] = 3; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = 5; dr[1] = "&Telerik"; dr[2] = 3; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = 6; dr[1] = "&WINDOWS"; dr[2] = 1; dt.Rows.Add(dr); return dt; } Workaround: set the DefaultTreeView before subscribing to the treeview events. this.radBreadCrumb1.DefaultTreeView = this.radTreeView1; this.radTreeView1.NodeFormatting += radTreeView1_NodeFormatting; this.radTreeView1.SelectedNodeChanged += radTreeView1_SelectedNodeChanged;
I've got a tree with multiple nodes like
document1
-page 1
-page 2
document1
-page 1
-page 2
-page 3
...
document10
-page 1
-page 2
Due to the size of the treeview, only 2 or 3 documents are on screen, the rest is scrolled. (manually added items, no dynamic or lazy loading)
Lets say I click page 2 of document one, hold the mouse button to select more and go down to the last document (the tree is automatically scrolled down, as expected)
But when I go back to review what I selected, only the last items on screen are selected (documents 9 and 10 for example).
When I try to do the same selection with the arrow keys and the shift key, it works fine, but not with the mouse.
Greetings,
While testing the exporting feature of RadTreeView, I noticed the following issue :
Using the code below , everything works just fine :
Me
.RadTreeView1.RightToLeft = System.Windows.Forms.RightToLeft.Yes
Dim
exporter
As
TreeViewSpreadExport =
New
TreeViewSpreadExport(
Me
.RadTreeView1)
AddHandler
exporter.CellFormatting,
AddressOf
exporter_CellFormatting
exporter.ExportFormat = SpreadExportFormat.Xlsx
exporter.ExportVisualSettings =
False
exporter.ExportImages =
False
exporter.ExportChildNodesGrouped =
True
exporter.CollapsedNodeOption = HiddenOption.ExportAlways
Dim
renderer
As
SpreadExportRenderer =
New
SpreadExportRenderer()
exporter.RunExport(
"D:\test.xlsx"
, renderer)
But, the following line of the code raises an error in a specific circumasntance (I describe it more, further in the thread) :
exporter.RunExport(
"D:\test.xlsx"
, renderer)
Error Screenshot is attached : 1.jpg
Details about the error :
System.ArgumentOutOfRangeException
HResult=0x80131502
Message=value should be greater or equal than 0 and less or equal than 7.
Parameter name: value
Source=Telerik.Windows.Documents.Spreadsheet
StackTrace:
at Telerik.WinControls.UI.RadButtonBase.buttonElement_Click(
Object
sender, EventArgs e)
at Telerik.WinControls.RadElement.OnClick(EventArgs e)
at Telerik.WinControls.UI.RadButtonElement.OnClick(EventArgs e)
at Telerik.WinControls.RadElement.DoClick(EventArgs e)
at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at Telerik.WinControls.RadControl.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(
String
[] commandLine)
The Specific Circumstance :
In my RadTreeView's NodeMouseClick , I add some child nodes to the node which is clicked, at runtime :
Dim
_Node1
As
RadTreeNode = e.Node.Nodes.Add(
"Node 1"
)
Dim
_Node2
As
RadTreeNode = e.Node.Nodes.Add(
"Node 2"
)
Dim
_Node3
As
RadTreeNode = e.Node.Nodes.Add(
"Node 3"
)
Then I found out that setting "exporter.ExportChildNodesGrouped" to True causes the error. But if it is set to false, no error raised even in the above Circumstance.
P.S Normally setting "exporter.ExportChildNodesGrouped" to True or False doesn't cause any error, but adding some child nodes at run time surly does.
Thanks for your attention.
Sub New()
InitializeComponent()
Me.RadTreeView1.Nodes.Clear()
Me.RadTreeView1.CheckBoxes = True
Dim node = New RadTreeNode("1") With {.CheckType = CheckType.CheckBox, .Checked = True, .CheckState = ToggleState.Indeterminate}
RadTreeView1.Nodes.Add(node)
node.Nodes.Add(New RadTreeNode("1.1") With {.CheckType = CheckType.RadioButton, .Checked = True, .CheckState = ToggleState.Indeterminate})
node.Nodes.Add(New RadTreeNode("1.2") With {.CheckType = CheckType.RadioButton})
node.Nodes.Add(New RadTreeNode("1.3") With {.CheckType = CheckType.RadioButton})
node = New RadTreeNode("2") With {.CheckType = CheckType.CheckBox, .Checked = True, .CheckState = ToggleState.Indeterminate}
RadTreeView1.Nodes.Add(node)
RadTreeView1.Nodes.Add(New RadTreeNode("3"))
End Sub
Workaround:
Sub New()End Sub
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."
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);
How to reproduce:
DataTable table = new DataTable();
table.Columns.Add("ParentId", typeof(int));
table.Columns.Add("ChildId", typeof(int));
table.Columns.Add("ProductId", typeof(int));
table.Columns.Add("ProductCode", typeof(string));
table.Rows.Add(0, 1, 3, "Pr - 01");
table.Rows.Add(1, 2, 4, "P r- 02");
table.Rows.Add(1, 3, 5, "Pr - 03");
this.radTreeView1.DisplayMember = "ProductCode";
this.radTreeView1.ParentMember = "ParentId";
this.radTreeView1.ChildMember = "ChildId";
this.radTreeView1.ValueMember = "ProductId";
this.radTreeView1.DataSource = table;
Code snippet for reproducing the problem:
Private Sub RadForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.SongsTableAdapter.Fill(Me.MusicCollectionDataSet.Songs)
Me.ArtistsTableAdapter.Fill(Me.MusicCollectionDataSet.Artists)
Me.AlbumsTableAdapter.Fill(Me.MusicCollectionDataSet.Albums)
AddHandler Me.RadTreeView1.NodeDataBound, AddressOf RadTreeView1_NodeDataBound
Me.RadTreeView1.DataSource = Me.ArtistsBindingSource
Me.RadTreeView1.DisplayMember = "ArtistName"
Me.RadTreeView1.ValueMember = "ArtistID"
Me.RadTreeView1.RelationBindings.Add(New RelationBinding(Me.AlbumsBindingSource, "AlbumName", "ArtistID", "ArtistID", "AlbumID"))
Me.RadTreeView1.RelationBindings.Add(New RelationBinding(Me.SongsBindingSource, "SongName", "AlbumID", "AlbumID", "SongID"))
Me.RadTreeView1.CheckBoxes = True
Me.RadTreeView1.AutoCheckChildNodes = True
Me.RadTreeView1.TriStateMode = True
Me.RadTreeView1.ExpandAll()
End Sub
Private Sub RadTreeView1_NodeDataBound(sender As Object, e As RadTreeViewEventArgs)
If e.Node.Level = 0 Then
e.Node.CheckType = CheckType.None
Else
e.Node.CheckType = CheckType.CheckBox
End If
End Sub
Workaround: instead of using the NodeDataBound event, use the NodeFormatting event to hide the checkboxes for the desired nodes:
Private Sub RadTreeView1_NodeFormatting(sender As Object, e As TreeNodeFormattingEventArgs)
If e.Node.Level = 0 Then
e.NodeElement.ToggleElement.Visibility = Telerik.WinControls.ElementVisibility.Collapsed
Else
e.NodeElement.ToggleElement.Visibility = Telerik.WinControls.ElementVisibility.Visible
End If
End Sub
Steps to reproduce:
1. Set SortOrder to Ascending
2. Rename a root node
I am using RadTreeView and setting FullRowSelect = false. This works for Windows7 them but doesn't work for Fluent theme.
1. Open Telerik Theme Viewer
2. Choose "Item Containers"
3. Observe "Tree"
4. Choose Theme "Office2019Dark"
Expected: Tree still shows content
Actual: Elements are not visible
Please use the attached sample project.
Result in 2021.1.326:
Result in 2021.2.511
If the list separator for the culture is ";"
and you have nodes in RadTreeView that are bold, the following XML will be serialized:
var xml = "<TreeView xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" MultiSelect=\"true\" AllowDragDrop=\"true\" LabelEdit=\"true\" AllowDrop=\"true\"> <Nodes Text=\"New Package\" Expanded=\"true\" ImageKey=\"Package\" Font=\"Microsoft Sans Serif; 8,25pt; style=Bold\"> <Tag xsi:type=\"xsd:string\"><Info><FullName>\\New Package</FullName><ObjectType>Package</ObjectType><IsRunnable>False</IsRunnable><IsContainer>true</IsContainer></Info></Tag> <Nodes Text=\"Query Engine\" ImageKey=\"QueryEngine\" Expanded=\"true\" Font=\"Microsoft Sans Serif; 8,25pt; style=Bold\"> <Tag xsi:type=\"xsd:string\"><Info><FullName>\\Query Engine</FullName><ObjectType>QueryEngine</ObjectType><IsRunnable>true</IsRunnable><IsTableEntity>true</IsTableEntity><IsCut>false</IsCut></Info></Tag> </Nodes> <Nodes Text=\"Connector\" ImageKey=\"Irion.SQLServer\"> <Tag xsi:type=\"xsd:string\"><Info><FullName>\\Connector</FullName><ObjectType>DBConnection</ObjectType><IsCut>false</IsCut></Info></Tag> </Nodes> <Nodes Text=\"Connector Link\" ImageKey=\"DatabaseDatalink\"> <Tag xsi:type=\"xsd:string\"><Info><FullName>\\Connector Link</FullName><ObjectType>DatabaseDatalink</ObjectType><IsRunnable>true</IsRunnable><IsTableEntity>true</IsTableEntity><IsCut>false</IsCut></Info></Tag> </Nodes> </Nodes></TreeView>";
However, if you try to load this layout on another machine where the list separator is "," the nodes wouldn't be bold:
Expected:
Actual:
Note: the problematic part is how the font is stored actually: "Microsoft Sans Serif; 8.25pt; style=Bold"