Completed
Last Updated: 09 Oct 2014 11:57 by ADMIN
ADMIN
Dimitar
Created on: 29 Jul 2014 14:02
Category: TreeView
Type: Bug Report
0
FIX. RadTreeView - when the control is used in combination with breadcrumb and its data source is reset, exception is thrown.
To reproduce use the following function to reset the data source of the treeview
public void LoadObjects()
{
    radBreadCrumb1.DefaultTreeView = null;

    tvObjects.DataSource = null;
    
    tvObjects.DataSource = GetTable();
    tvObjects.DisplayMember = "Name";
    tvObjects.ValueMember = "Name";
    
    radBreadCrumb1.DefaultTreeView = tvObjects;
}

Workaround:
public void LoadObjects()
{
    radBreadCrumb1.DefaultTreeView = null;

    MethodInfo mi = typeof(RadBreadCrumb).GetMethod("value_Selected", BindingFlags.Instance | BindingFlags.NonPublic);
    Delegate delegateToRemove = Delegate.CreateDelegate(typeof(RadTreeView.RadTreeViewEventHandler), this.radBreadCrumb1, mi);

    this.tvObjects.TreeViewElement.SelectedNodeChanged -= (RadTreeView.RadTreeViewEventHandler)delegateToRemove;

    mi = typeof(RadBreadCrumb).GetMethod("value_NodeExpand", BindingFlags.Instance | BindingFlags.NonPublic);
    delegateToRemove = Delegate.CreateDelegate(typeof(RadTreeView.TreeViewEventHandler), this.radBreadCrumb1, mi);

    this.tvObjects.TreeViewElement.NodeExpandedChanged -= (RadTreeView.TreeViewEventHandler)delegateToRemove;
 
    tvObjects.DataSource = null;
    
    tvObjects.DataSource = GetTable();
    tvObjects.DisplayMember = "Name";
    tvObjects.ValueMember = "Name";
    
    radBreadCrumb1.DefaultTreeView = tvObjects;
}
0 comments