Hello,
Is it not possible to use the TreeView bound to a self-referencing BindingList with Load on Demand in Q1 2011? If I bind the treeview to the binding list, no expand/collapse buttons show up on the last level. In Q1 2010, I had the treeview loading certain levels on demand by handling NodeExpandedChanged, and adding items to the bindinglist. Now, there is no expand/collapse button to do this. Any advice would be appreciated. Thanks!
Sonya
Is it not possible to use the TreeView bound to a self-referencing BindingList with Load on Demand in Q1 2011? If I bind the treeview to the binding list, no expand/collapse buttons show up on the last level. In Q1 2010, I had the treeview loading certain levels on demand by handling NodeExpandedChanged, and adding items to the bindinglist. Now, there is no expand/collapse button to do this. Any advice would be appreciated. Thanks!
Sonya
6 Answers, 1 is accepted
0
Hi Sonya L,
Thank you for this question.
In this scenario you can use the new NodesNeeded event introduced in the last version of our RadTreeView control. More information you can found in our online documentation.
The following code snippet describes an alternative solution:
This solution has a known issue concerning the indent of RadTreeNodes from different levels. We will address the issue in our upcoming service pack scheduled for the next week.
Do not hesitate to contact us if you have more questions.
Kind regards,
Julian Benkov
the Telerik team
Thank you for this question.
In this scenario you can use the new NodesNeeded event introduced in the last version of our RadTreeView control. More information you can found in our online documentation.
The following code snippet describes an alternative solution:
public
partial
class
Form6 : Form
{
class
LazyTreeNode : RadTreeNode
{
private
bool
loaded;
public
bool
Loaded
{
get
{
return
loaded; }
set
{ loaded = value; }
}
}
public
Form6()
{
InitializeComponent();
radTreeView1.ShowLines =
true
;
using
(radTreeView1.DeferRefresh())
{
for
(
int
i = 0; i < 10; i++)
{
radTreeView1.Nodes.Add(
"RootNode"
+ i.ToString());
}
}
}
private
void
radTreeView1_NodeExpandedChanged(
object
sender, Telerik.WinControls.UI.RadTreeViewEventArgs e)
{
LazyTreeNode node = e.Node
as
LazyTreeNode;
if
(node.Loaded)
{
return
;
}
node.Nodes.BeginUpdate();
for
(
int
i = 0; i < 10; i++)
{
node.Nodes.Add(
"ChildNode"
+ i.ToString());
}
node.Nodes.EndUpdate();
node.Loaded =
true
;
}
private
void
radTreeView1_CreateNode(
object
sender, Telerik.WinControls.UI.CreateTreeNodeEventArgs e)
{
e.Node =
new
LazyTreeNode();
}
private
void
radTreeView1_NodeFormatting(
object
sender, TreeNodeFormattingEventArgs e)
{
e.NodeElement.ExpanderElement.Visibility = Telerik.WinControls.ElementVisibility.Visible;
}
}
This solution has a known issue concerning the indent of RadTreeNodes from different levels. We will address the issue in our upcoming service pack scheduled for the next week.
Do not hesitate to contact us if you have more questions.
Kind regards,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Sonya L
Top achievements
Rank 1
answered on 20 Apr 2011, 04:20 PM
What I really want to do is bind the treeview to a binding list, then when a node is expanded, add items to the binding list, and have them appear in the tree view. This worked fine in q1 2010, but not in q1 2011. Is this still possible?
0
Hello Sonya L,
The new version of RadTreeView control can not mix bound and unbound data mode. You can download Q1 2011 SP1 release and use the code snippet from the previous post as a solution. If you continue to experience the problems, please send me a sample project or some part of your real project. This will allow me to find the best solution for your case where a BindingList is used.
All the best,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

Sonya L
Top achievements
Rank 1
answered on 03 May 2011, 04:35 PM
Is there a workaround for the indenting issue that still occurs in 2011 Q1 SP1? it looks like my nodes without children are indented further to the right than the ones with children. Also, it looks like the expander graphic is set to the minus (-) when I first load and display the tree, but the nodes aren't actually expanded. Has anyone seen this happen before? I'm still looking through my code to see what might be causing it, and working with the above example to get Load on Demand working (I'm not using NodesNeeded). Thanks!
0

Sonya L
Top achievements
Rank 1
answered on 03 May 2011, 07:33 PM
Please ignore the part about the expander graphic. I think our custom theme may have it backwards. Still need a workaround for the indention though.
0
Hi Sonya L,
Julian Benkov
the Telerik team
Please find the answer in this forum thread:
http://www.telerik.com/community/forums/winforms/treeview/treeview-indent-in-2011-q1-sp1.aspx
Julian Benkov
the Telerik team