Completed
Last Updated: 30 Jun 2015 08:28 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 08 Jun 2015 09:11
Category: TreeView
Type: Bug Report
0
FIX. RadTreeView - ArgumentException when drag/drop a node between two RadTreeView controls and a screen-tip is shown
To reproduce:

public Form1()
{
    InitializeComponent();

    this.radTreeView1.AllowDragDrop = true;
    this.radTreeView2.AllowDragDrop = true;
    for (int i = 0; i < 5; i++)
    {
        this.radTreeView1.Nodes.Add("Node1." + i);
        this.radTreeView2.Nodes.Add("Node2." + i);
    }
    this.radTreeView1.ScreenTipNeeded += radTreeView1_ScreenTipNeeded;
    this.radTreeView2.ScreenTipNeeded += radTreeView1_ScreenTipNeeded;
}

RadOffice2007ScreenTipElement _screenTip = new RadOffice2007ScreenTipElement();

private void radTreeView1_ScreenTipNeeded(object sender, Telerik.WinControls.ScreenTipNeededEventArgs e)
{
    _screenTip.CaptionLabel.Text = "Caption";
    _screenTip.MainTextLabel.Text = "text";
    _screenTip.AutoSize = true;
    e.Delay = 2000;
    e.Item.ScreenTip = _screenTip;
}

Steps:
1. Drag a node from the first RadTreeView to the other while the screen-tip is shown for the dragged node.
2. When the screen-tip is about to be hidden, the error occurs.

Workaround:

private void radTreeView1_DragStarting(object sender, RadTreeViewDragCancelEventArgs e)
{
    if (_screenTip.IsElementVisible)
    {
        this.radTreeView1.Behavior.HideScreenTip();
    }
   
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
2 comments
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 15 Jun 2015 12:08
When you perform the drag and drop operation fast without waiting for the screen-tip to show before start dragging, the same error will occur. You can deal with this case by using the following code snippet:
private void radTreeView1_DragStarting(object sender, RadTreeViewDragCancelEventArgs e)
{
    PropertyInfo pi = typeof(ComponentInputBehavior).GetProperty("ScreenPresenter", BindingFlags.NonPublic | BindingFlags.Instance);
 
     TipStates state=(TipStates)pi.GetValue(((ComponentBehavior)this.radTreeView1.Behavior), null).GetType().GetField("taskbarState",
         BindingFlags.NonPublic| BindingFlags.Instance).GetValue(pi.GetValue(((ComponentBehavior)this.radTreeView1.Behavior), null)) ;
     state = TipStates.Visible;
     pi.GetValue(((ComponentBehavior)this.radTreeView1.Behavior), null).GetType().GetMethod("Hide",
         BindingFlags.Public | BindingFlags.Instance).Invoke(  pi.GetValue(((ComponentBehavior)this.radTreeView1.Behavior), null),null);
}
Claude
Posted on: 08 Jun 2015 14:29
This work around does not work, the problem persists.