private void DragSource_DragEnter(object sender, Infragistics.DragDrop.DragDropCancelEventArgs e)
        {
            //set drag data
            var xdt = e.DragSource as CardPanel;
            var cpr = xdt.TryFindParent <DataRecordPresenter>();
            var ep  = cpr.DataRecord.DataItem as NeighborhoodWatch;

            if (ep == null)
            {
                e.Cancel = true;
            }
            else
            {
                e.Data = ep;
            }

            //change allow or not
            e.OperationType = OperationType.DropNotAllowed;
            if (e.DropTarget is XamDataTreeNodeControl)
            {
                XamDataTreeNodeControl drca = e.DropTarget as XamDataTreeNodeControl;
                var dtnode = drca.Node;
                if (dtnode != null)
                {
                    DirectoryNode dr = dtnode.Data as DirectoryNode;
                    if (dr.IsFolder)
                    {
                        e.OperationType = OperationType.Move;
                    }
                }
            }
        }
예제 #2
0
        private void DragSource_DragEnter(object sender, Infragistics.DragDrop.DragDropCancelEventArgs e)
        {
            //set drag data
            var xdt = e.DragSource as Border;
            var cpr = xdt.TryFindParent <Expander>();
            var ep  = cpr.DataContext as PolicyElementViewModel;

            if (ep == null)
            {
                e.Cancel = true;
            }
            else
            {
                e.Data = ep;
            }

            //change allow or not
            e.OperationType = OperationType.DropNotAllowed;
            if (e.DropTarget is XamDataTreeNodeControl)
            {
                e.OperationType = OperationType.Move;
            }
        }