private void ItemDragDelta(object sender, DragablzDragDeltaEventArgs eventArgs) { var bounds = new Size(ItemsPresenterWidth, ItemsPresenterHeight); var desiredLocation = new Point( eventArgs.DragablzItem.X + eventArgs.DragDeltaEventArgs.HorizontalChange, eventArgs.DragablzItem.Y + eventArgs.DragDeltaEventArgs.VerticalChange ); if (ItemsOrganiser != null) { if (FixedItemCount > 0 && ItemsOrganiser.Sort(DragablzItems()).Take(FixedItemCount).Contains(eventArgs.DragablzItem)) { eventArgs.Handled = true; return; } desiredLocation = ItemsOrganiser.ConstrainLocation(this, bounds, new Point(eventArgs.DragablzItem.X, eventArgs.DragablzItem.Y), new Size(eventArgs.DragablzItem.ActualWidth, eventArgs.DragablzItem.ActualHeight), desiredLocation, eventArgs.DragablzItem.DesiredSize); } foreach (var dragableItem in DragablzItems() .Except(new[] { eventArgs.DragablzItem })) // how about Linq.Where() ? { dragableItem.IsSiblingDragging = true; } eventArgs.DragablzItem.IsDragging = true; eventArgs.DragablzItem.X = desiredLocation.X; eventArgs.DragablzItem.Y = desiredLocation.Y; if (ItemsOrganiser != null) { ItemsOrganiser.OrganiseOnDrag( this, bounds, DragablzItems().Except(new[] { eventArgs.DragablzItem }), eventArgs.DragablzItem); } eventArgs.DragablzItem.BringIntoView(); eventArgs.Handled = true; }
private void ThumbOnDragDelta(object sender, DragDeltaEventArgs dragDeltaEventArgs) { var thumb = (Thumb)sender; var previewEventArgs = new DragablzDragDeltaEventArgs(PreviewDragDelta, this, dragDeltaEventArgs); OnPreviewDragDelta(previewEventArgs); if (previewEventArgs.Cancel) { thumb.CancelDrag(); } if (!previewEventArgs.Handled) { var eventArgs = new DragablzDragDeltaEventArgs(DragDelta, this, dragDeltaEventArgs); OnDragDelta(eventArgs); if (eventArgs.Cancel) { thumb.CancelDrag(); } } }
protected void OnPreviewDragDelta(DragablzDragDeltaEventArgs e) { RaiseEvent(e); }