是否有对 WPF 的引用可以使控件可拖动?
Is there a reference to WPF which enables controls being Draggable?
我有一个 WPF 应用程序,我想在其中使某些控件在 canvas 上可拖动。我知道 Windows.Forms 有一个 Nuget 包 Control.Draggable 但它与我的 WPF 代码冲突:
using System.Windows.Forms;
public partial class MainWindow : Window
{
System.Windows.Controls.Button newButton = new System.Windows.Controls.Button();
ControlExtension.Draggable(newButton, true);
}
在 newButton 下划线的错误消息:
Cannot convert from 'System.Windows.Controls.Button' to
'System.Windows.Forms.Control'
有什么方法可以克服这个错误并轻松地在 WPF 中应用可拖动功能吗?
您可能想查看 dong-wpf-dragdrop。它是一个开源库,可以轻松地在 WPF 中实现和使用拖放功能。
我有一个 WPF 应用程序,我想在其中使某些控件在 canvas 上可拖动。我知道 Windows.Forms 有一个 Nuget 包 Control.Draggable 但它与我的 WPF 代码冲突:
using System.Windows.Forms;
public partial class MainWindow : Window
{
System.Windows.Controls.Button newButton = new System.Windows.Controls.Button();
ControlExtension.Draggable(newButton, true);
}
在 newButton 下划线的错误消息:
Cannot convert from 'System.Windows.Controls.Button' to 'System.Windows.Forms.Control'
有什么方法可以克服这个错误并轻松地在 WPF 中应用可拖动功能吗?
您可能想查看 dong-wpf-dragdrop。它是一个开源库,可以轻松地在 WPF 中实现和使用拖放功能。