本文介绍了Silverlight4.0 TreeViewItem拖放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个问题如何取消阻力".
就我而言.当客户将treeViewItem拖动到目标时,显示messageBox,如果单击取消"按钮,则放弃拖动操作.
遵循是我的代码,但没有用.请帮忙!
XAML:
Hi All,
I have a question ''how to cancel drag.''
In my case. when customer drag treeViewItem to target, show messageBox, if ''Cancel'' button click, give up drag operation.
Follow is my code, but it dose not work.pls help!
XAML:
<my:TreeViewDragDropTarget x:Name="tvddtCategroy" AllowDrop="true" AllowedSourceEffects="Move" ItemDroppedOnTarget="tvddtCategroy_ItemDroppedOnTarget">
<controls:TreeView x:Name="tvCategory" BorderBrush="White" AllowDrop="True"
</controls:TreeView>
</my:TreeViewDragDropTarget>
C#:
C#:
private void tvddtCategroy_ItemDroppedOnTarget(object sender, ItemDragEventArgs e)
{
if (MessageBox.Show("Are you sure to move this category?", "", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
{
e.Cancel = true;
e.Handled = true;
}
}
推荐答案
这篇关于Silverlight4.0 TreeViewItem拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!