Completed
Last Updated: 12 Jun 2014 20:26 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 05 Jun 2014 07:30
Category: TreeView
Type: Bug Report
0
FIX. RadTreeView - DropHint is not rendered when the Form.TopMost property is set to true
To reproduce : add a RadTreeView with several nodes and use the following code snippet:

this.radTreeView1.AllowDragDrop = true;
this.TopMost = true;

Note that dragging a node will no longer display the "DropHint" line.

Workaround:

class CustomDragDropService : TreeViewDragDropService
{
    public CustomDragDropService(RadTreeViewElement owner) : base(owner)
    {
    }

    protected override void UpdateHintPosition(Point mousePosition)
    {
        FieldInfo fi = typeof(TreeViewDragDropService).GetField("dropHintWindow",
            BindingFlags.NonPublic | BindingFlags.Instance);
       
        RadLayeredWindow window = fi.GetValue(this) as RadLayeredWindow;
        window.TopMost = true;
        base.UpdateHintPosition(mousePosition);
    }
}

class CustomTreeViewElement : RadTreeViewElement
{
    //Enable themeing for the element
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(RadTreeViewElement);
        }
    }

    //Replace the default drag drop service with the custom one
    protected override TreeViewDragDropService CreateDragDropService()
    {
        return new CustomDragDropService(this);
    }
}

class CustomTreeView : RadTreeView
{
    //Replace the default element with the custom one
    protected override RadTreeViewElement CreateTreeViewElement()
    {
        return new CustomTreeViewElement();
    }

    //Enable theming for the control
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadTreeView).FullName;
        }
    }
}
0 comments