private void OnSplitterDragStarted(object sender, DragStartedEventArgs args) { SplitterGrip originalSource = args.OriginalSource as SplitterGrip; if (originalSource == null) { return; } args.Handled = true; originalSource.DragDelta += new DragDeltaEventHandler(this.OnSplitterResized); originalSource.DragCompleted += new DragCompletedEventHandler(this.OnSplitterDragCompleted); if (!this.ShowResizePreview) { return; } this.currentPreviewWindow = new SplitterResizePreviewWindow(); this.currentPreviewWindow.Show((UIElement)originalSource); }
private void OnSplitterDragCompleted(object sender, DragCompletedEventArgs args) { SplitterGrip grip = sender as SplitterGrip; if (grip == null) { return; } args.Handled = true; if (this.IsShowingResizePreview) { this.currentPreviewWindow.Hide(); this.currentPreviewWindow = (SplitterResizePreviewWindow)null; if (!args.Canceled) { Point logicalUnits = new Point(args.HorizontalChange, args.VerticalChange).DeviceToLogicalUnits(); this.CommitResize(grip, logicalUnits.X, logicalUnits.Y); } } grip.DragDelta -= new DragDeltaEventHandler(this.OnSplitterResized); grip.DragCompleted -= new DragCompletedEventHandler(this.OnSplitterDragCompleted); }