当前位置: 首页>>代码示例>>C#>>正文


C# IDropInfo类代码示例

本文整理汇总了C#中IDropInfo的典型用法代码示例。如果您正苦于以下问题:C# IDropInfo类的具体用法?C# IDropInfo怎么用?C# IDropInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IDropInfo类属于命名空间,在下文中一共展示了IDropInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Drop

    public virtual void Drop(IDropInfo dropInfo)
    {
      int insertIndex = dropInfo.InsertIndex;
      IList destinationList = GetList(dropInfo.TargetCollection);
      IEnumerable data = ExtractData(dropInfo.Data);

      if (dropInfo.DragInfo.VisualSource == dropInfo.VisualTarget)
      {
        IList sourceList = GetList(dropInfo.DragInfo.SourceCollection);
        foreach (object o in data)
        {
          int index = sourceList.IndexOf(o);

          if (index == -1)
            continue;

          sourceList.RemoveAt(index);

          if (sourceList == destinationList && index < insertIndex)
            --insertIndex;
        }
      }

      foreach (object o in data)
        destinationList.Insert(insertIndex++, o);
    }
开发者ID:modulexcite,项目名称:LoreSoft.Shared,代码行数:26,代码来源:DefaultDropHandler.cs

示例2: Drop

        public void Drop(IDropInfo dropInfo)
        {
            var insertIndex = dropInfo.InsertIndex;

            MediaItemViewModel[] mediaItemViewModels = { dropInfo.Data as MediaItemViewModel };

            var destinationList = _trackViewModel.Track.MediaItems;
            var sourceList = mediaItemViewModels.First().TrackViewModel.Track.MediaItems;

            foreach (var index in mediaItemViewModels.Select(o => sourceList.IndexOf(o.MediaItem)).Where(index => index != -1))
            {
                sourceList.RemoveAt(index);

                if (sourceList == destinationList && index < insertIndex)
                {
                    --insertIndex;
                }
            }

            foreach (var o in mediaItemViewModels)
            {
                if (insertIndex < destinationList.Count)
                    destinationList.Insert(insertIndex++, o.MediaItem);
                else
                    destinationList.Add(o.MediaItem);
            }
        }
开发者ID:AugustinasNomicas,项目名称:MultitrackPlayer,代码行数:27,代码来源:TrackViewModelDropHandler.cs

示例3: Dropped

			public void Dropped(IDropInfo dropInfo, DragDropEffects effects)
			{
				bool isCopy, isMove;
				GuiHelper.ConvertDragDropEffectToCopyMove(effects, out isCopy, out isMove);

				_projectBrowseControl._controller.FolderTree_DragEnded(isCopy, isMove);
			}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:7,代码来源:TreeView_DragHandler.cs

示例4: DragOverPlaylistManagementList

        protected void DragOverPlaylistManagementList(IDropInfo _dropInfo)
        {
            MediaItem mediaItem = (MediaItem)_dropInfo.DragInfo.SourceItem;
            ListBox listBoxTarget, listBoxSource;
            PlaylistObjectMediaList playlistList = this.currentPlaylistManagementList();

            listBoxTarget = (ListBox)_dropInfo.VisualTarget;
            listBoxSource = (ListBox)_dropInfo.DragInfo.VisualSource;

            if (playlistList == null || !mediaItem.isAllowedToDropOnTrackList() || !playlistList.isEditable)
            {
                _dropInfo.Effects = System.Windows.DragDropEffects.None;
                return;
            }

            this.savePlaylistManagementListPosition();

            listBoxTarget = (ListBox)_dropInfo.VisualTarget;
            listBoxSource = (ListBox)_dropInfo.DragInfo.VisualSource;

            if (listBoxTarget.Name == listBoxSource.Name)
                _dropInfo.Effects = System.Windows.DragDropEffects.Move;
            else
                _dropInfo.Effects = System.Windows.DragDropEffects.Copy;
        }
开发者ID:stoennies,项目名称:raumwiese,代码行数:25,代码来源:MainWindow_DragNDrop.cs

示例5: DragOver

 public virtual void DragOver(IDropInfo dropInfo)
 {
     if (CanAcceptData(dropInfo)) {
     dropInfo.Effects = DragDropEffects.Copy;
     dropInfo.DropTargetAdorner = DropTargetAdorners.Insert;
       }
 }
开发者ID:TomKaltz,项目名称:gong-wpf-dragdrop,代码行数:7,代码来源:DefaultDropHandler.cs

示例6: CanAcceptData

        public static bool CanAcceptData(IDropInfo dropInfo)
        {
            if (dropInfo == null || dropInfo.DragInfo == null)
            {
                return false;
            }

            if (dropInfo.DragInfo.SourceCollection == dropInfo.TargetCollection)
            {
                return GetList(dropInfo.TargetCollection) != null;
            }
            else if (dropInfo.DragInfo.SourceCollection is ItemCollection)
            {
                return false;
            }
            else
            {
                if (TestCompatibleTypes(dropInfo.TargetCollection, dropInfo.Data))
                {
                    return !IsChildOf(dropInfo.VisualTargetItem, dropInfo.DragInfo.VisualSourceItem);
                }
                else
                {
                    return false;
                }
            }
        }
开发者ID:rdingwall,项目名称:gong-wpf-dragdrop,代码行数:27,代码来源:DefaultDropHandler.cs

示例7: Drop

        public virtual void Drop(IDropInfo dropInfo)
        {
            var insertIndex = dropInfo.InsertIndex;
            var destinationList = GetList(dropInfo.TargetCollection);
            var data = ExtractData(dropInfo.Data);

            if (dropInfo.DragInfo.VisualSource == dropInfo.VisualTarget)
            {
                var sourceList = GetList(dropInfo.DragInfo.SourceCollection);

                foreach (var o in data)
                {
                    var index = sourceList.IndexOf(o);

                    if (index != -1)
                    {
                        sourceList.RemoveAt(index);

                        if (sourceList == destinationList && index < insertIndex)
                        {
                            --insertIndex;
                        }
                    }
                }
            }

            foreach (var o in data)
            {
                destinationList.Insert(insertIndex++, o);
            }
        }
开发者ID:rdingwall,项目名称:gong-wpf-dragdrop,代码行数:31,代码来源:DefaultDropHandler.cs

示例8: NotSupportedException

        void IDropTarget.Drop(IDropInfo dropInfo)
        {
            var target = dropInfo.TargetItem as IExpressionTreeNode;

            if (target == null)
                return;

            var source = dropInfo.Data as IExpressionTreeNode;

            if (source == null)
                return;

            if (source is PredicateNode && target is PredicateNode)
            {
                Tree.InjectInto(source, target);
            }
            else
            {
                throw new NotSupportedException();
            }
            

            // todo: do this as XamlVirutalizingCollection

            var ft = new ExpressionTreeTraversingCollection();
            ft.UpdateRoot(Tree.Root);
            FlattenedTree = ft;
            //FlattenedTree.UpdateRoot(Tree.Root);
        }
开发者ID:squaredinfinity,项目名称:Foundation,代码行数:29,代码来源:BooleanExpressionTreeControl.cs

示例9: CanAcceptData

        /// <summary>
        /// Test the specified drop information for the right data.
        /// </summary>
        /// <param name="dropInfo">The drop information.</param>
        public static bool CanAcceptData(IDropInfo dropInfo)
        {
            if (dropInfo == null || dropInfo.DragInfo == null) {
            return false;
              }

              if (!dropInfo.IsSameDragDropContextAsSource) {
            return false;
              }

              // do not drop on itself
              var isTreeViewItem = dropInfo.InsertPosition.HasFlag(RelativeInsertPosition.TargetItemCenter)
                           && dropInfo.VisualTargetItem is TreeViewItem;
              if (isTreeViewItem && dropInfo.VisualTargetItem == dropInfo.DragInfo.VisualSourceItem) {
            return false;
              }

              if (dropInfo.DragInfo.SourceCollection == dropInfo.TargetCollection) {
            var targetList = dropInfo.TargetCollection.TryGetList();
            return targetList != null;
              }
            //      else if (dropInfo.DragInfo.SourceCollection is ItemCollection) {
            //        return false;
            //      }
              else if (dropInfo.TargetCollection == null) {
            return false;
              } else {
            if (TestCompatibleTypes(dropInfo.TargetCollection, dropInfo.Data)) {
              var isChildOf = IsChildOf(dropInfo.VisualTargetItem, dropInfo.DragInfo.VisualSourceItem);
              return !isChildOf;
            } else {
              return false;
            }
              }
        }
开发者ID:emsaks,项目名称:gong-wpf-dragdrop,代码行数:39,代码来源:DefaultDropHandler.cs

示例10: DragOver

 public void DragOver(IDropInfo dropInfo)
 {
     if (dropInfo.Data is IList<MediaItemViewModel> || dropInfo.Data is MediaItemViewModel)
     {
         dropInfo.Effects = DragDropEffects.Copy | DragDropEffects.Move;
         dropInfo.DropTargetAdorner = DropTargetAdorners.Insert;
     }
 }
开发者ID:AugustinasNomicas,项目名称:MultitrackPlayer,代码行数:8,代码来源:TrackViewModelDropHandler.cs

示例11: OnImported

 protected override void OnImported(IEnumerable<Track> tracks, IDropInfo dropInfo)
 {
     Track track = tracks.First();
     if (playCommand.CanExecute(track))
     {
         playCommand.Execute(track);
     }
 }
开发者ID:rdingwall,项目名称:mixplanner,代码行数:8,代码来源:ImportFilesAndPlayCommand.cs

示例12:

 //
 // The drop handler is only used for the grouping example.
 //
 void IDropTarget.DragOver(IDropInfo dropInfo)
 {
     DragDrop.DefaultDropHandler.DragOver(dropInfo);
     if (dropInfo.TargetGroup == null)
     {
         dropInfo.Effects = System.Windows.DragDropEffects.None;
     }
 }
开发者ID:samgerene,项目名称:gong-wpf-dragdrop,代码行数:11,代码来源:Data.cs

示例13: DragOver

        public void DragOver(IDropInfo dropInfo)
        {
            if (this.IsFileDropInfo(dropInfo))
            {
                dropInfo.Effects = DragDropEffects.Link;
                return;
            }

            ITreeItem source = dropInfo.Data as ITreeItem;
            ITreeItem target = dropInfo.TargetItem as ITreeItem;
            if (source == null
                || target == null
                || source == target)
            {
                return;
            }

            // Cannot drag if the source's parent is read only
            if (source.Parent != null && (source.Parent.IsReadOnly || !source.IsEnabled))
            {
                return;
            }

            // Ensure the source isn't a parent to the target
            ITreeItem node = target.Parent;
            while (node != null)
            {
                if (node == source)
                {
                    return;
                }

                node = node.Parent;
            }

            // Determine the action to perform
            switch (dropInfo.InsertPosition)
            {
                // Handle dropping directly onto a node
                case RelativeInsertPosition.TargetItemCenter:
                    if (!target.IsReadOnly && target.IsEnabled)
                    {
                        dropInfo.DropTargetAdorner = DropTargetAdorners.Highlight;
                        dropInfo.Effects = DragDropEffects.Move;
                    }

                    break;

                // Insertion cases
                default:
                    if (target.Parent == null || (!target.Parent.IsReadOnly && target.IsEnabled))
                    {
                        dropInfo.DropTargetAdorner = DropTargetAdorners.Insert;
                        dropInfo.Effects = DragDropEffects.Move;
                    }
                    break;
            }
        }
开发者ID:Thor132,项目名称:CSProto,代码行数:58,代码来源:MainViewModel.cs

示例14: Drop

        public void Drop(IDropInfo dropInfo)
        {
            var collection = (ObservableCollection<PlayableBase>)((ICollectionView)dropInfo.TargetCollection).SourceCollection;

            if (dropInfo.Data is PlayableBase)
            {
                var track = (PlayableBase)dropInfo.Data;
                int newIndex;
                var currentIndex = dropInfo.DragInfo.SourceIndex;

                if (dropInfo.InsertIndex > collection.Count - 1)
                {
                    newIndex = collection.Count - 1;
                }
                else
                {
                    newIndex = dropInfo.InsertIndex;
                    if (newIndex > 0 && newIndex > currentIndex) newIndex--;
                }

                if (currentIndex == newIndex) return;
                collection.Move(currentIndex, newIndex);
                MainViewModel.Instance.MusicManager.SelectedTrack = collection[newIndex];
            }
            else if (dropInfo.Data is IEnumerable<PlayableBase>)
            {
                var tracks = ((IEnumerable<PlayableBase>)dropInfo.Data).OrderBy(x => collection.IndexOf(x)).ToList();

                int index;
                if (dropInfo.InsertIndex >= collection.Count)
                {
                    index = collection.Count - 1;
                }
                else
                {
                    index = dropInfo.InsertIndex;
                    if (collection.IndexOf(tracks.Last()) < index)
                    {
                        index--;
                    }
                }

                if (tracks.Any(track => collection.IndexOf(track) == index))
                {
                    return;
                }

                if (index < collection.IndexOf(tracks[0]))
                {
                    tracks.Reverse();
                }
                
                foreach (var track in tracks)
                {
                    collection.Move(collection.IndexOf(track), index); 
                }
            }
        }
开发者ID:WELL-E,项目名称:Hurricane,代码行数:58,代码来源:TrackListDropHandler.cs

示例15: Drop

            public override void Drop(IDropInfo dropInfo)
            {
                if (dropInfo.TargetCollection.Cast<object>().Contains(dropInfo.Data))
                {
                    return;
                }

                base.Drop(dropInfo);
            }
开发者ID:martinjuhasz,项目名称:Softwaretechnik,代码行数:9,代码来源:UsergroupControlViewModel.cs


注:本文中的IDropInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。