Telerik RadTreeView阻力

Telerik RadTreeView阻力,telerik,radtreeview,Telerik,Radtreeview,当我在ChildWindow中使用RadTreeView时,即使我将IsDragDropEnabled属性设置为“True”,我也无法拖动项目。但是当我在UserControl中使用RadTreeView时,它可以拖动 问题是什么?我如何解决它?您必须触发事件 承包商 this.treeView1.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDr

当我在
ChildWindow
中使用
RadTreeView
时,即使我将
IsDragDropEnabled
属性设置为“True”,我也无法拖动项目。但是当我在
UserControl
中使用
RadTreeView
时,它可以拖动

问题是什么?我如何解决它?

您必须触发事件

承包商

this.treeView1.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDropQuery), true);
this.treeView1.AddHandler(RadDragAndDropManager.DropQueryEvent,新事件处理程序(OnDropQuery),true);
然后

private void OnDropQuery(对象发送方,DragDropQueryEventArgs e)
{
RadTreeViewItem destinationItem=e.Options.Destination作为RadTreeViewItem;
对象源=this.GetItemFromPayload(e.Options.Payload);
对象目标=destinationItem!=null?destinationItem.Item:null;
DropPosition position=destinationItem!=null?destinationItem.DropPosition:DropPosition.Inside;
if(源!=null&&target!=null)
{
Section sourceSection=源作为节;
区段targetSection=作为区段的目标;
问题来源问题=问题来源;
问题targetQuestion=目标为问题;
if(sourceQuestion!=null)
{
尝试
{
if(sourceQuestion!=null&&targetQuestion!=null&&object.ReferenceEquals(sourceQuestion,targetQuestion))
{
sourceSection.Questions.Remove(sourceQuestion);
targetSection.Questions.Add(sourceQuestion);
e、 QueryResult=false;
回来
}
if(targetQuestion!=null&&position==DropPosition.Inside)
{
sourceSection.Questions.Remove(sourceQuestion);
targetSection.Questions.Add(sourceQuestion);
e、 QueryResult=false;
回来
}
if(position!=DropPosition.Inside&&targetQuestion==null)
{
sourceSection.Questions.Remove(sourceQuestion);
targetSection.Questions.Add(sourceQuestion);
e、 QueryResult=false;
回来
}
}
捕获(例外情况除外)
{
}
}
}
其他的
{
e、 QueryResult=false;
回来
}
e、 QueryResult=true;
}

就是它。

您正在使用哪个RadTreeView?ASP.NET、WPF、Silverlight还是WinForms?
 private void OnDropQuery(object sender, DragDropQueryEventArgs e)
    {
        RadTreeViewItem destinationItem = e.Options.Destination as RadTreeViewItem;
        object source = this.GetItemFromPayload<object>(e.Options.Payload);
        object target = destinationItem != null ? destinationItem.Item : null;
        DropPosition position = destinationItem != null ? destinationItem.DropPosition : DropPosition.Inside;

        if (source != null && target != null)
        {
            Section sourceSection = source as Section;
            Section targetSection = target as Section;
            Question sourceQuestion = source as Question;
            Question targetQuestion = target as Question;

            if (sourceQuestion != null)
            {
                try
                {

                    if (sourceQuestion != null && targetQuestion != null && object.ReferenceEquals(sourceQuestion, targetQuestion))
                    {
                        sourceSection.Questions.Remove(sourceQuestion);
                        targetSection.Questions.Add(sourceQuestion);
                        e.QueryResult = false;
                        return;
                    }

                    if (targetQuestion != null && position == DropPosition.Inside)
                    {
                        sourceSection.Questions.Remove(sourceQuestion);
                        targetSection.Questions.Add(sourceQuestion);
                        e.QueryResult = false;
                        return;
                    }

                    if (position != DropPosition.Inside && targetQuestion == null)
                    {
                        sourceSection.Questions.Remove(sourceQuestion);
                        targetSection.Questions.Add(sourceQuestion);
                        e.QueryResult = false;
                        return;
                    }
                }
                catch (Exception ex)
                {


                }
            }
        }
        else
        {
            e.QueryResult = false;
            return;
        }
        e.QueryResult = true;

    }