Completed
Last Updated: 10 Feb 2016 13:13 by ADMIN
ADMIN
Dimitar
Created on: 20 Jan 2016 07:53
Category: TreeView
Type: Bug Report
0
FIX. RadTreeView - exception when the keyboard search is enabled and there is no selected nodes.
To reproduce:
1) Create a Windows Forms project.
2) Add a RadTreeView control.
3) Set the KeyboardSearchEnabled property to true.
4) Run the application and click in the tree (just to make sure it has the focus).
5) Using the keyboard, press a letter key.
6) Minimize the application.

The same exception occurs if there are no selected nodes.

Workaround:
class MyTreeView : RadTreeView
{
    protected override RadTreeViewElement CreateTreeViewElement()
    {
        return new MyTreeViewElement();
    }
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadTreeView).FullName;
        }

        set
        {
            base.ThemeClassName = value;
        }
    }
}
class MyTreeViewElement : RadTreeViewElement
{
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(RadTreeViewElement);
        }
    }
    protected override RadTreeNode GetFirstMatch(string searchCriteria, RadTreeNodeCollection nodes)
    {
        if(this.SelectedNode == null && this.Items == null)
        {
            return null;
        }
        return base.GetFirstMatch(searchCriteria, nodes);
    }
}

0 comments