Пример #1
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="args"></param>
		protected virtual void OnModelDropped(ModelDropEventArgs args) {
			if (this.ModelDropped != null)
				this.ModelDropped(this, args);
		}
Пример #2
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="args"></param>
		protected virtual void OnModelCanDrop(ModelDropEventArgs args) {
			if (this.ModelCanDrop != null)
				this.ModelCanDrop(this, args);
		}
Пример #3
0
		/// <summary>
		/// Trigger ModelCanDrop
		/// </summary>
		/// <param name="args"></param>
		protected virtual void OnModelCanDrop(ModelDropEventArgs args) {

			// Don't allow drops from other list, if that's what's configured
			if (!this.AcceptExternal && args.SourceListView != null && args.SourceListView != this.ListView) {
				args.Effect = DragDropEffects.None;
				args.DropTargetLocation = DropTargetLocation.None;
				args.InfoMessage = "This list doesn't accept drops from other lists";
				return;
			}

			if (this.ModelCanDrop != null)
				this.ModelCanDrop(this, args);
		}
Пример #4
0
		/// <summary>
		/// Do the work of processing the dropped items
		/// </summary>
		/// <param name="args"></param>
		public virtual void RearrangeModels(ModelDropEventArgs args) {
			switch (args.DropTargetLocation) {
				case DropTargetLocation.AboveItem:
					this.ListView.MoveObjects(args.DropTargetIndex, args.SourceModels);
					break;
				case DropTargetLocation.BelowItem:
					this.ListView.MoveObjects(args.DropTargetIndex + 1, args.SourceModels);
					break;
				case DropTargetLocation.Background:
					this.ListView.AddObjects(args.SourceModels);
					break;
				default:
					return;
			}

			if (args.SourceListView != this.ListView) {
				args.SourceListView.RemoveObjects(args.SourceModels);
			}
		}
Пример #5
0
		/// <summary>
		/// Trigger OnModelDropped
		/// </summary>
		/// <param name="args"></param>
		protected override void OnModelDropped(ModelDropEventArgs args) {
			base.OnModelDropped(args);

			if (!args.Handled)
				this.RearrangeModels(args);
		}
Пример #6
0
		/// <summary>
		/// Trigger OnModelCanDrop
		/// </summary>
		/// <param name="args"></param>
		protected override void OnModelCanDrop(ModelDropEventArgs args) {
			base.OnModelCanDrop(args);

			if (args.Handled)
				return;

			args.Effect = DragDropEffects.Move;

			// Don't allow drops from other list, if that's what's configured
			if (!this.AcceptExternal && args.SourceListView != this.ListView) {
				args.Effect = DragDropEffects.None;
				args.DropTargetLocation = DropTargetLocation.None;
				args.InfoMessage = "This list doesn't accept drops from other lists";
			}

			// If we are rearranging a list, don't allow drops on the background
			if (args.DropTargetLocation == DropTargetLocation.Background && args.SourceListView == this.ListView) {
				args.Effect = DragDropEffects.None;
				args.DropTargetLocation = DropTargetLocation.None;
			}
		}