相关疑难解决方法(0)

在WPF DataGrid上拖动Drop Row行为

我试图做一个附加行为来重新排序行bby做 Drag & Drop

我发现了一些解决方案(在Stackoverflow上和通过谷歌搜索)并使用它们我试图做出行为......我从Hordcodenet网站上拿了例子(我现在没有链接)

public static class DragDropRowBehavior
{
    private static DataGrid dataGrid;

    private static Popup popup;

    private static bool enable;

    private static object draggedItem;

    public static object DraggedItem
    {
        get { return DragDropRowBehavior.draggedItem; }
        set { DragDropRowBehavior.draggedItem = value; }
    }

    public static Popup GetPopupControl(DependencyObject obj)
    {
        return (Popup)obj.GetValue(PopupControlProperty);
    }

    public static void SetPopupControl(DependencyObject obj, Popup value)
    {
        obj.SetValue(PopupControlProperty, value);
    }

    // Using a DependencyProperty as the backing store for PopupControl.  This enables animation, styling, binding, etc... …
Run Code Online (Sandbox Code Playgroud)

c# wpf drag-and-drop wpfdatagrid attachedbehaviors

3
推荐指数
2
解决办法
7417
查看次数

标签 统计

attachedbehaviors ×1

c# ×1

drag-and-drop ×1

wpf ×1

wpfdatagrid ×1