Пример #1
0
        protected override IScriptCommand executeInner(ParameterDic pm, UIElement sender, RoutedEventArgs evnt, IUIInput input, IList <IUIInputProcessor> inpProcs)
        {
            DragEventArgs            devnt          = evnt as DragEventArgs;
            ISupportDrop             dropTarget     = pm.GetValue <ISupportDrop>(DropTargetKey);
            IEnumerable <IDraggable> draggables     = pm.GetValue <IEnumerable <IDraggable> >(DraggablesKey);
            DragDropEffectsEx        allowedEffects = pm.HasValue(AllowedEffectsKey) ? pm.GetValue <DragDropEffectsEx>(AllowedEffectsKey)
                : devnt != null ? (DragDropEffectsEx)devnt.AllowedEffects : DragDropEffectsEx.All;

            if (dropTarget != null && draggables != null)
            {
                QueryDropEffects queryDropEffect = QueryDropEffects.None;
                if (devnt != null)
                {
                    queryDropEffect = dropTarget.QueryDrop(draggables, allowedEffects);
                    devnt.Effects   = (DragDropEffects)queryDropEffect.SupportedEffects;
                }
                else
                {
                    queryDropEffect = dropTarget.QueryDrop(draggables, allowedEffects);
                }

                pm.SetValue(DestinationKey, queryDropEffect, SkipIfExists);
            }
            return(NextCommand);
        }
Пример #2
0
        public override QueryDropEffects QueryDrop(IEnumerable <T> models, DragDropEffectsEx allowedEffects)
        {
            if (models.Count() > 0)
            {
                return(QueryDropEffects.CreateNew(DragDropEffectsEx.Move));
            }

            _tcvm.SelectedItem = _tvm;
            return(QueryDropEffects.None);
        }