【发布时间】:2014-06-11 06:16:31
【问题描述】:
我正在尝试取消 xceed 数据网格(社区版)网格 (http://wpftoolkit.codeplex.com/wikipage?title=DataGrid) 中某些列的重新排序/拖放功能
到目前为止,我所做的是监听 PreviewMouseLeftButtonUp / Down 事件。然后我可以在 Down 设置处理 = true 并且用户不能对列执行任何操作(没有排序或任何事情)或在 Up 上检查 IsBeingDragged 是否为真。但是如果我设置 e.Handled 然后,该列将保持拖动模式。我想要做的是取消整个拖动并将列放回原来的位置,或者(如果可能的话)尽可能靠近放置的列。
谁能指导我?
private void ColumnManagerCell_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
// Check that the Original Source is a ColumnManagerCell
if (sender.GetType() == typeof(Xceed.Wpf.DataGrid.ColumnManagerCell))
{
ColumnManagerCell col = sender as ColumnManagerCell;
if (col.IsBeingDragged)
{
// user attempted to move the column to a new location, or to the GroupByControl area
e.Handled = true;
}
}
}
【问题讨论】:
标签: wpf wpftoolkit