Approved
Last Updated: 05 Apr 2016 12:54 by ADMIN
ADMIN
Dimitar
Created on: 04 Apr 2016 12:12
Category: TreeView
Type: Bug Report
0
FIX. RadTreeView - the DropHint has invalid location when the tree view is scrolled to the right.
To reproduce:
- Open the attached project.
- Scroll to the right.
- Drag a node.
- The DropHint line is outside the window.
 
Workaround:
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;
        }
    }
}
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 MyDragDropService(this);
    }
}
class MyDragDropService : TreeViewDragDropService
{
    public MyDragDropService(RadTreeViewElement owner)
    : base(owner)
{ }
    protected override void UpdateHintPosition(Point mousePosition)
    {
        base.UpdateHintPosition(mousePosition);
        RadLayeredWindow dropHint =typeof(TreeViewDragDropService).GetField("dropHintWindow", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(this) as RadLayeredWindow;
        if (dropHint != null)
        {
            TreeNodeElement nodeElement = this.DropTarget as TreeNodeElement;
           
            dropHint.Location = new Point (nodeElement.ElementTree.Control.PointToScreen(Point.Empty).X, dropHint.Location.Y);
        }
    }
}


Attached Files:
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments