Hi,
Create new form and paste code below.
Run form, expand "root" node and select any item. SelectedNodeChanged event should write to console value "1".
Then click button to rebuild re-build the tree, again expand "root" node and select any item.
This time SelectedNodeChanged will write to console value: "2".
Create new form and paste code below.
Run form, expand "root" node and select any item. SelectedNodeChanged event should write to console value "1".
Then click button to rebuild re-build the tree, again expand "root" node and select any item.
This time SelectedNodeChanged will write to console value: "2".
private
void
Form1_Load(
object
sender, EventArgs e)
{
RadButton b =
new
RadButton();
b.Text =
"Rebuild"
;
b.Dock = DockStyle.Top;
b.Click += b_Click;
rtv =
new
RadTreeView();
rtv.SelectedNodeChanged += rtv_SelectedNodeChanged;
rtv.Dock = DockStyle.Bottom;
this
.Controls.Add(b);
this
.Controls.Add(rtv);
Rebuild(rtv);
}
RadTreeView rtv =
new
RadTreeView();
private
void
rtv_SelectedNodeChanged(
object
sender, RadTreeViewEventArgs e)
{
Console.WriteLine(rtv.SelectedNodes.Count);
}
private
void
b_Click(
object
sender, EventArgs e)
{
Rebuild(rtv);
}
private
void
Rebuild(RadTreeView rtv)
{
rtv.Nodes.Clear();
rtv.Nodes.Add(
"root"
);
rtv.Nodes[0].Nodes.Add(
"level 1 item 1"
);
rtv.Nodes[0].Nodes.Add(
"level 1 item 2"
);
rtv.Nodes[0].Nodes.Add(
"level 1 item 3"
);
rtv.Nodes[0].Nodes.Add(
"level 1 item 4"
);
// this don't work
rtv.SelectedNodes.Clear();
}