Hi,
When using a node's Nodes.Clear() method the tree view scrolls up to the top and shows the tree view's first node.
If I load the Form2 and scroll down a bit so the first node is no longer visible, and check the check box, then double click on a node it will expand, and make the top node visible.
My work around is to remove each node individually, i.e.
If I load the Form2 and scroll down a bit so the first node is no longer visible, then double click on a node it will expand.
My experience with .Net is 7 years. My experience with Rad is about 2 weeks.
When using a node's Nodes.Clear() method the tree view scrolls up to the top and shows the tree view's first node.
If I load the Form2 and scroll down a bit so the first node is no longer visible, and check the check box, then double click on a node it will expand, and make the top node visible.
My work around is to remove each node individually, i.e.
If I load the Form2 and scroll down a bit so the first node is no longer visible, then double click on a node it will expand.
Public
Class
Form2
Inherits
System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected
Overrides
Sub
Dispose(
ByVal
disposing
As
Boolean
)
Try
If
disposing
AndAlso
components IsNot
Nothing
Then
components.Dispose()
End
If
Finally
MyBase
.Dispose(disposing)
End
Try
End
Sub
'Required by the Windows Form Designer
Private
components
As
System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private
Sub
InitializeComponent()
Me
.RadTreeView1 =
New
Telerik.WinControls.UI.RadTreeView()
Me
.CheckBox1 =
New
System.Windows.Forms.CheckBox()
CType
(
Me
.RadTreeView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me
.SuspendLayout()
'
'RadTreeView1
'
Me
.RadTreeView1.BackColor = System.Drawing.SystemColors.Control
Me
.RadTreeView1.Cursor = System.Windows.Forms.Cursors.
Default
Me
.RadTreeView1.Font =
New
System.Drawing.Font(
"Segoe UI"
, 8.25!)
Me
.RadTreeView1.ForeColor = System.Drawing.Color.Black
Me
.RadTreeView1.Location =
New
System.Drawing.Point(12, 11)
Me
.RadTreeView1.Name =
"RadTreeView1"
Me
.RadTreeView1.RightToLeft = System.Windows.Forms.RightToLeft.No
'
'
'
Me
.RadTreeView1.RootElement.ForeColor = System.Drawing.Color.Black
Me
.RadTreeView1.Size =
New
System.Drawing.Size(150, 250)
Me
.RadTreeView1.SpacingBetweenNodes = -1
Me
.RadTreeView1.TabIndex = 3
Me
.RadTreeView1.Text =
"RadTreeView1"
'
'CheckBox1
'
Me
.CheckBox1.AutoSize =
True
Me
.CheckBox1.Location =
New
System.Drawing.Point(168, 23)
Me
.CheckBox1.Name =
"CheckBox1"
Me
.CheckBox1.Size =
New
System.Drawing.Size(81, 17)
Me
.CheckBox1.TabIndex = 4
Me
.CheckBox1.Text =
"CheckBox1"
Me
.CheckBox1.UseVisualStyleBackColor =
True
'
'Form2
'
Me
.AutoScaleDimensions =
New
System.Drawing.SizeF(6.0!, 13.0!)
Me
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me
.ClientSize =
New
System.Drawing.Size(292, 273)
Me
.Controls.Add(
Me
.CheckBox1)
Me
.Controls.Add(
Me
.RadTreeView1)
Me
.Name =
"Form2"
Me
.Text =
"Form2"
CType
(
Me
.RadTreeView1, System.ComponentModel.ISupportInitialize).EndInit()
Me
.ResumeLayout(
False
)
Me
.PerformLayout()
End
Sub
Friend
WithEvents
RadTreeView1
As
Telerik.WinControls.UI.RadTreeView
Private
Sub
Form2_Load(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
MyBase
.Load
For
i = 0
To
20
Dim
node = RadTreeView1.Nodes.Add(
"node "
+ i.ToString)
For
j = 0
To
20
Dim
n2 = node.Nodes.Add(
"node "
+ i.ToString +
" "
+ j.ToString)
Next
Next
RadTreeView1.LazyMode =
True
End
Sub
Private
Sub
RadTreeView1_NodeExpandedChanged(sender
As
System.
Object
, e
As
Telerik.WinControls.UI.RadTreeViewEventArgs)
Handles
RadTreeView1.NodeExpandedChanged
Dim
n = RadTreeView1.SelectedNode
If
n
Is
Nothing
Then
Return
If
CheckBox1.Checked
Then
n.Nodes.Clear()
Else
While
n.Nodes.Count > 0
n.Nodes.RemoveAt(0)
End
While
End
If
For
i = 0
To
10
Dim
node = n.Nodes.Add(
"Expando "
+ i.ToString)
Next
End
Sub
End
Class
My experience with .Net is 7 years. My experience with Rad is about 2 weeks.
- OS version and applied service packs
Microsoft Windows Server 2003, Standard Edition, Service Pack 2
- Regional and language settings, if different from En-US
English (Australia)
- .NET version (.NET2, .NET3, .NET3.5)
.NET 4.0.30319 SP1Rel, Visual Studio 2010 Version 10.0.40219.1 SP1Rel
- Exact version of the Telerik product
Runtime Version v2.0.50727, Version 2011.2.11.831