C# 更改listview中的拖动光标

C# 更改listview中的拖动光标,c#,wpf,listview,drag-and-drop,C#,Wpf,Listview,Drag And Drop,我必须创建一个包含可拖动项的列表视图。我在codeproject中找到了一个解决方案 这是在网上找到的最好的代码。现在我需要将拖动光标更改为sizeAll 有没有办法更改默认的拖动光标?我下载了您链接到的程序 要实现您想要的功能,请在ListViewDragDropManager.cs的#区域挂钩事件区域中添加以下内容: this.listView.GiveFeedback += listView_GiveFeedback; 然后将其添加到#区域事件处理方法部分: private void

我必须创建一个包含可拖动项的列表视图。我在codeproject中找到了一个解决方案

这是在网上找到的最好的代码。现在我需要将拖动光标更改为sizeAll


有没有办法更改默认的拖动光标?

我下载了您链接到的程序

要实现您想要的功能,请在
ListViewDragDropManager.cs
#区域挂钩事件
区域中添加以下内容:

this.listView.GiveFeedback += listView_GiveFeedback;
然后将其添加到
#区域事件处理方法
部分:

private void listView_GiveFeedback(object sender, GiveFeedbackEventArgs e)
{
    if (e.Effect == DragDropEffects.Move)
    {
        e.UseDefaultCursors = false;
        Mouse.SetCursor(Cursors.SizeAll);
    }
    else
        e.UseDefaultCursors = true;

    e.Handled = true;
}
this.listView.GiveFeedback -= listView_GiveFeedback;
不要忘记取消订阅
#区域取消预订事件
部分:

private void listView_GiveFeedback(object sender, GiveFeedbackEventArgs e)
{
    if (e.Effect == DragDropEffects.Move)
    {
        e.UseDefaultCursors = false;
        Mouse.SetCursor(Cursors.SizeAll);
    }
    else
        e.UseDefaultCursors = true;

    e.Handled = true;
}
this.listView.GiveFeedback -= listView_GiveFeedback;