从A控件的子项Items 中拖一个子项目A1到B控件中时;
使用RadDragAndDropManager 增加两个拖入前的判断事件OnDropQueryDim ,拖入后的完成事件 OnDropInfoHandlerDim。
当A控件和B控件的类型不相同时(如都为A为RadTreeView ,B为ListBox)时,事件触发正常;
但是当A控件和B控件的类型相同时(如都为RadTreeView)时,事件OnDropQueryDim 不能触发;
不知道是不是Telerik控件的BUG ? 请教哪位高手指点一下!
public CubeAnalysis()
{
InitializeComponent();
this.InitCube();
#region 拖拉事件绑定
//设置 允许被移到rowDim对象上
RadDragAndDropManager.SetAllowDrop(rowDim, true);
//其它对象移到 rowDim对象前 事件
RadDragAndDropManager.AddDropQueryHandler(rowDim, OnDropQueryDim);
//其它对象移到rowDim对象后 事件
RadDragAndDropManager.AddDropInfoHandler(rowDim, OnDropInfoHandlerDim);
#endregion
}
private void OnDropQueryDim(object sender, DragDropQueryEventArgs e)
{
if (e.Options.Source is GridViewHeaderCell)
{
return;
}
// We allow drop only if the dragged items are products:
ICollection draggedItems = e.Options.Payload as ICollection;
bool result = draggedItems.Cast<RadTreeViewItem>().All((RadTreeViewItem item) => item.Tag is CubeHierarchie);
e.QueryResult = result;
e.Handled = true;
}
private void OnDropInfoHandlerDim(object sender, DragDropEventArgs e)
{
e.Handled = true;
if (e.Options.Status == DragStatus.DropImpossible)
{
e.Handled = true;
}
}