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 in the attached gif file. You will notice that the nodes are displayed multiple times.
Workaround: it seems that if the BeginUpdate/EndUpdate methods are not used in the PerformNodeMove methods, the issue is not reproducible
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
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
To reproduce: please refer to the attached gif files with the different versions of the Telerik UI for WinForms suite . You will notice that while you are dragging a node the default cursor is an arrow with a small rectangle. If you hold the Ctrl key pressed while dragging the node, the default cursor is an arrow with a small rectangle and '+'. With the latest version, the '+' sign is missing when you hold the Ctrl key.
To reproduce: please refer to the attached sample project and try to reorder a node. You will notice that the message box is not rendered properly. //case 2 private void DragDropService_PreviewDragDrop(object sender, RadDropEventArgs e) { e.Handled = true; RadMessageBox.Show(this, "Showing a messagebox under dragending doesn't work correctly."); } //case 1 private void radTreeView1_DragEnding(object sender, Telerik.WinControls.UI.RadTreeViewDragCancelEventArgs e) { //e.Cancel = true; //RadMessageBox.Show(this, "Showing a messagebox under dragending doesn't work correctly."); } Workaround: subscribe to the TreeViewElement.DragDropService.PreviewDragDrop and set the Handled argument to true if you want to cancel the drop operation. Then, handle the TreeViewElement.DragDropService.Stopped event and show the desired message. public Form1() { InitializeComponent(); this.radTreeView1.TreeViewElement.DragDropService.PreviewDragDrop += DragDropService_PreviewDragDrop; this.radTreeView1.TreeViewElement.DragDropService.Stopped+=DragDropService_Stopped; } private void DragDropService_Stopped(object sender, EventArgs e) { RadMessageBox.Show(this, "Showing a messagebox under dragending doesn't work correctly."); } private void DragDropService_PreviewDragDrop(object sender, RadDropEventArgs e) { e.Handled = true; }
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 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
Please refer to the attached screenshot from the Demo application >> General Settings example. Workaround: private void radTreeView1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e) { e.NodeElement.ExpanderElement.Margin = new Padding(2, 0, 0, 0); }
An exception is thrown when changing the selection mode from Single to MultiSelect and then scrolling and selecting nodes.
To reproduce: public Form1() { InitializeComponent(); this.radTreeView1.NodesNeeded+=radTreeView1_NodesNeeded; } private void radTreeView1_NodesNeeded(object sender, Telerik.WinControls.UI.NodesNeededEventArgs e) { Console.WriteLine("NodesNeeded"); } As a result StackOverFlowException is thrown. Workaround: Do not subscribe to the NodesNeeded event if the LazyMode property is set to false.
In self-reference mode you can not have root Nodes with different ID's
Allow setting the AutoExpand time of node when drag operation is performing.
IMPROVE. RadTreeView - add support for DataBindings of RadTreeNode Resolution: The feature is duplicated with feedback item ADD. RadTreeView - add support for binding the checkboxes of the nodes to a field in the data Here is the link to item: http://feedback.telerik.com/Project/154/Feedback/Details/112624-add-radtreeview-add-support-for-binding-the-checkboxes-of-the-nodes-to-a-field.
To reproduces: add a RadTreeView and set up Object-relational hierarchy. Use the following code: NorthwindEntities context = new NorthwindEntities(); public Form1() { InitializeComponent(); context.Categories.Load(); context.Products.Load(); this.radTreeView1.DataSource = context.Categories.Local.ToBindingList(); this.radTreeView1.DisplayMember = "CategoryName\\ProductName"; this.radTreeView1.ChildMember = "Categories\\Products"; } private void radButton1_Click(object sender, EventArgs e) { this.radTreeView1.ChildMember = "Products\\Categories"; this.radTreeView1.DisplayMember = "ProductName\\CategoryName"; this.radTreeView1.DataSource = context.Products.Local.ToBindingList(); } When you click the RadButton, NullReferenceException occurs. Resolution: Add more descriptive exception message.
it appears to work okay on android, but I can't use it from an ipad
The disabling of the scroll bars is broke as shit. I have tried rtvDrainage.HorizontalScroll.Visible = false; rtvDrainage.HorizontalScroll.Maximum = 0; rtvDrainage.HorizontalScroll.Enabled = false; rtvDrainage.AutoScroll = false; rtvDrainage.EnableDeferredScrolling = false; rtvDrainage.EnableKineticScrolling = false; rtvDrainage.HScrollBar.Maximum = 0; rtvDrainage.HScrollBar.Visibility = Telerik.WinControls.ElementVisibility.Collapsed; NOTHING stops this damn thing from showing up (i put this in both the load and in a button to hit after loading) 2 hours wasted trying to make a scroll bar not show up.........
FIX. RadTreeView - when adding row in the underlying source, the nodes in the tree are collapsed, even when using DeferRefresh
FIX. RadTreeView - the tree should keep its selection, expanded nodes and scroll position when new record is added to its underlying data source