private void RotateThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = DataContext as ContentControl; if (this.designerItem != null) { this.canvas = VisualTreeHelper.GetParent(this.designerItem) as Canvas; if (this.canvas != null) { this.centerPoint = this.designerItem.TranslatePoint( new Point(this.designerItem.Width * this.designerItem.RenderTransformOrigin.X, this.designerItem.Height * this.designerItem.RenderTransformOrigin.Y), this.canvas); Point startPoint = Mouse.GetPosition(this.canvas); this.startVector = Point.Subtract(startPoint, this.centerPoint); this.rotateTransform = this.designerItem.RenderTransform as RotateTransform; if (this.rotateTransform == null) { this.designerItem.RenderTransform = new RotateTransform(0); this.initialAngle = 0; } else { this.initialAngle = this.rotateTransform.Angle; } } } }
protected override void OnThumbDragStarted(DragStartedEventArgs e) { if (ThumbDragStarted != null) ThumbDragStarted(this, e); base.OnThumbDragStarted(e); }
private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = this.DataContext as ContentControl; if (this.designerItem != null) { this.canvas = VisualTreeHelper.GetParent(this.designerItem) as ContentPresenter; if (this.canvas != null) { this.transformOrigin = this.designerItem.RenderTransformOrigin; this.rotateTransform = this.designerItem.RenderTransform as RotateTransform; if (this.rotateTransform != null) { this.angle = this.rotateTransform.Angle * Math.PI / 180.0; } else { this.angle = 0.0d; } AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.canvas); if (adornerLayer != null) { this.adorner = new SizeAdorner(this.designerItem); adornerLayer.Add(this.adorner); } } } }
protected override void OnThumbDragStarted(DragStartedEventArgs e) { if (SliderDragStarted != null) { SliderDragStarted(this, e); } }
public DragablzDragStartedEventArgs(DragablzItem dragablzItem, DragStartedEventArgs dragStartedEventArgs) : base(dragablzItem) { if (dragStartedEventArgs == null) throw new ArgumentNullException("dragStartedEventArgs"); _dragStartedEventArgs = dragStartedEventArgs; }
private void RotateThumb_DragStarted(object sender, DragStartedEventArgs e) { adornedElement = this.AdornedElement as FrameworkElement; Thumb hitThumb = sender as Thumb; if (adornedElement == null || hitThumb == null) return; parentElement = adornedElement.Parent as FrameworkElement; if (parentElement != null) { this.centerPoint = adornedElement.TranslatePoint( new Point(adornedElement.Width * 0.5, adornedElement.Height * 0.5), parentElement); Point startPoint = Mouse.GetPosition(parentElement); this.startVector = Point.Subtract(startPoint, this.centerPoint); this.rotateTransform = adornedElement.RenderTransform as RotateTransform; if (this.rotateTransform == null) { adornedElement.RenderTransform = new RotateTransform( 0, adornedElement.Width * 0.5, adornedElement.Height * 0.5); this.initialAngle = 0; } else { this.initialAngle = this.rotateTransform.Angle; } } }
private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e) { this.element = DataContext as BaseObject; if (this.element != null) { this.canvasWorkspace = VisualTreeHelper.GetParent(this.element) as CanvasWorkspace; } }
private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = DataContext as DesignerItem; if (this.designerItem != null) { this.designerCanvas = VisualTreeHelper.GetParent(this.designerItem) as DesignerCanvas; } }
/// <summary> /// The on thumb drag started. /// </summary> /// <param name="e"> /// The e. /// </param> protected override void OnThumbDragStarted(DragStartedEventArgs e) { base.OnThumbDragStarted(e); var editableObject = this.DataContext as IEditableObject; if (editableObject != null) { editableObject.BeginEdit(); } }
// called when thumb drag started (window resize started) void Thumb_DragStarted(object sender, DragStartedEventArgs e) { WindowThumb thumb = (WindowThumb)sender; // store settings of the window, will be used to resize and move the window _mouseStartPosition = PointToScreen(Mouse.GetPosition(_window)); _windowStartPosition = new Point(_window.Left, _window.Top); _windowStartSize = new Size(_window.Width, _window.Height); }
private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = DataContext as ContentControl; if (this.designerItem != null) { this.rotateTransform = this.designerItem.RenderTransform as RotateTransform; } }
private void DragStartedExecute(DragStartedEventArgs e) { var thumb = e.OriginalSource as Thumb; if (thumb == null) return; DraggedPoint = thumb.DataContext as EditablePointViewModel; DragStartX = e.HorizontalOffset; DragStartY = e.VerticalOffset; }
private void DragStartedExecute(DragStartedEventArgs e) { var thumb = e.OriginalSource as Thumb; if (thumb == null) return; ResizedVisual = thumb.DataContext as ISizeableVisualViewModel; DragStartX = e.HorizontalOffset; DragStartY = e.VerticalOffset; }
private void NowPlayingElapsedSlider_DragStarted(object sender, DragStartedEventArgs e) { try { playbackController.BeginSeek(); } catch (Exception ex) { log.Error("PlaybackView.NowPlayingElapsedSlider_DragStarted", ex); } }
protected override void OnMouseDown(MouseButtonEventArgs e) { if (e.ChangedButton == Input.MouseButton.Left) { e.MouseDevice.Capture(this); dragStartPosition = e.AbsolutePosition; IsDragging = true; DragStartedEventArgs dragStartedEventArgs = new DragStartedEventArgs(DragStartedEvent, this); RaiseEvent(dragStartedEventArgs); e.Handled = dragStartedEventArgs.Handled; } }
/// <summary> /// Dragging has started, see if VM is IDiagramLinkViewModel and notify of moving start. /// </summary> void DragThumb_DragStarted(object sender, DragStartedEventArgs e) { diagramDesigner = DiagramHelper.GetDiagramDesigner(this); diagramDesignerVM = diagramDesigner.DataContext as IDiagramViewModel; selectedItem = null; selectedItemVM = null; edgePointVM = this.DataContext as IEdgePointViewModel; List<ISelectable> selection = diagramDesigner.SelectionService.CurrentSelection; if (selection.Count == 1) { foreach (ISelectable item in selection) { if (item is DiagramDesignerItem) if ((item as DiagramDesignerItem).IsDiagramLink) { selectedItem = item as DiagramDesignerItem; } } // create control to display on the drag adorner dragCanvas = new Canvas(); IDiagramLinkViewModel designerItem = selectedItem.DataContext as IDiagramLinkViewModel; selectedItemVM = designerItem; AddLinkAnchorAndShape(new PointD(designerItem.StartEdgePoint.X, designerItem.StartEdgePoint.Y), new PointD(designerItem.EndEdgePoint.X, designerItem.EndEdgePoint.Y)); // create drag adorner if (diagramDesigner != null && selectedItemVM != null && selectedItem != null && edgePointVM != null) { AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(diagramDesigner); if (adornerLayer != null) { this.dragAdorner = new DragAdorner(diagramDesigner, dragCanvas, false, 1.0); if (this.dragAdorner != null) { adornerLayer.Add(this.dragAdorner); e.Handled = true; } } } } e.Handled = false; }
private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e) { this.designerItem = DataContext as ContentControl; if (this.designerItem != null) { this.transformOrigin = this.designerItem.RenderTransformOrigin; RotateTransform rotateTransform = this.designerItem.RenderTransform as RotateTransform; if (rotateTransform != null) { this.angle = rotateTransform.Angle * Math.PI / 180.0; } else { this.angle = 0; } } }
protected override void OnDragStarted(object sender, DragStartedEventArgs e) { if (Target != null) { var canvas = VisualTreeHelper.GetParent(Target) as MaskCanvas; if (canvas != null) { transformOrigin = Target.RenderTransformOrigin; rotateTransform = Target.GetRenderTransform<RotateTransform>(); if (rotateTransform != null) { angle = rotateTransform.Angle * Math.PI / 180; } else { angle = 0.0; } } } }
/// <summary> /// Setzt designerCanvas und workflowItemViewModel und stößt lock des aktuellen WorkflowIteman. /// Wird beim Start des Drags aufgerufen. /// </summary> /// <param name="sender">MoveThumb</param> /// <param name="e">Eventspezifische Infos</param> private void startDrag(object sender, DragStartedEventArgs e) { // hole ContentControl, das derzeit bewegt wird Control designerItem = (Control)DataContext; if (designerItem != null) { // hole Item von aktuell bewegtem ContentControl workflowItemViewModel = (WorkflowItemViewModel)designerItem.DataContext; // merke Koordinaten zu Beginn des Drags startLeft = workflowItemViewModel.Left; startTop = workflowItemViewModel.Top; // Lock workflowItem - falls Item nicht gesperrt werden kann -> designerCanvas = null try { workflowItemViewModel.LockDrag(); // finde DesignerCanvas, damit Größenberechnung neu angestoßen werden kann DependencyObject parent = VisualTreeHelper.GetParent(designerItem); while (parent != null && !(parent is DesignerCanvas)) { parent = VisualTreeHelper.GetParent(parent); } if (parent is DesignerCanvas) { designerCanvas = (DesignerCanvas)parent; } } catch (Exception) { WorkflowEditorDesignerCanvasErrorViewModel.Instance.Error = "Das Item konnte nicht gesperrt werden. Bitte noch einmal versuchen."; } } }
private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e) { _wasMoved = false; DesignerCanvas.BeginChange(); }
protected override void OnThumbDragStarted(DragStartedEventArgs e) { base.OnThumbDragStarted(e); if (SeakStarted != null) SeakStarted(this, e); }
private void duration_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { isDragged = true; }
void thumbDragThumb_DragStarted(object sender, DragStartedEventArgs e) { this.HitDesignerItem = null; this.HitConnector = null; this.pathGeometry = null; this.Cursor = Cursors.Cross; this.connection.StrokeDashArray = new DoubleCollection(new double[] { 1, 2 }); if (sender == sourceDragThumb) { fixConnector = connection.Sink; dragConnector = connection.Source; } else if (sender == sinkDragThumb) { dragConnector = connection.Sink; fixConnector = connection.Source; } }
/// <summary> /// The column splitter change started. /// </summary> /// <param name="sender">The sender.</param> /// <param name="dragStartedEventArgs">The drag started event args.</param> private void ColumnSplitterChangeStarted(object sender, DragStartedEventArgs dragStartedEventArgs) { this.ColumnSplitterChangeDelta(sender, null); }
private void OnThumbDragStarted(object sender, DragStartedEventArgs e) { dragInitialValue = Value; e.Handled = true; }
private void OnMouseMove_Reorder(ref bool handled, Point mousePosition, Point mousePositionHeaders, Point mousePositionGrid, Point mousePositionGridParent, double distanceFromLeft, double distanceFromRight) { if (handled) { return; } #region handle entry into reorder mode if (_dragMode == DragMode.MouseDown && _dragColumn == null && (distanceFromRight > DATAGRIDCOLUMNHEADER_resizeRegionWidth && distanceFromLeft > DATAGRIDCOLUMNHEADER_resizeRegionWidth)) { DragStartedEventArgs dragStartedEventArgs = new DragStartedEventArgs(mousePositionGrid.X - _lastMousePositionGrid.Value.X, mousePositionGrid.Y - _lastMousePositionGrid.Value.Y); this.OwningGrid.OnColumnHeaderDragStarted(dragStartedEventArgs); handled = CanReorderColumn(this.OwningColumn); if (handled) { DataGridColumnHeader dragIndicator = new DataGridColumnHeader(); dragIndicator.OwningColumn = this.OwningColumn; dragIndicator.IsEnabled = false; dragIndicator.Content = this.Content; dragIndicator.ContentTemplate = this.ContentTemplate; if (this.OwningGrid.DragIndicatorStyle != null) { dragIndicator.Style = this.OwningGrid.DragIndicatorStyle; } // If the user didn't style the dragIndicator's Width, default it to the column header's width if (double.IsNaN(dragIndicator.Width)) { dragIndicator.Width = this.ActualWidth; } // If the user didn't style the dropLocationIndicator's Height, default to the column header's height // if (double.IsNaN(this.OwningGrid.ColumnDropLocationIndicator.Height)) { this.OwningGrid.ColumnDropLocationIndicator.Height = this.ActualHeight; } // pass the caret's data template to the user for modification DataGridColumnReorderingEventArgs columnReorderingEventArgs = new DataGridColumnReorderingEventArgs(this.OwningColumn) { DropLocationIndicator = this.OwningGrid.ColumnDropLocationIndicator, DragIndicator = dragIndicator }; this.OwningGrid.OnColumnReordering(columnReorderingEventArgs); if (columnReorderingEventArgs.Cancel) { return; } // The user didn't cancel, so prepare for the reorder _dragColumn = this.OwningColumn; _dragMode = DragMode.Reorder; _dragStartParent = mousePositionGridParent; // the mouse position relative to the ColumnHeader needs to be scaled to be in the same // dimensions as the DataGrid, so that it doesn't get out of sync later on _dragStart = this.OwningGrid.RenderTransform.Transform(mousePosition); // Display the reordering thumb if (_reorderingThumb == null) { _reorderingThumb = new Popup(); } _reorderingThumb.Child = columnReorderingEventArgs.DragIndicator; _reorderingThumb.IsOpen = true; // use the data template to populate the caret if (columnReorderingEventArgs.DropLocationIndicator != null) { Control child = columnReorderingEventArgs.DropLocationIndicator; this.OwningGrid.ColumnDropLocationIndicatorPopup.Child = child; this.OwningGrid.ColumnDropLocationIndicatorPopup.Height = child.ActualHeight; this.OwningGrid.ColumnDropLocationIndicatorPopup.Width = child.ActualWidth; this.OwningGrid.ColumnDropLocationIndicatorPopup.IsOpen = false; } } } #endregion #region handle reorder mode (eg, positioning of the popup) if (_dragMode == DragMode.Reorder && _reorderingThumb != null) { DragDeltaEventArgs dragDeltaEventArgs = new DragDeltaEventArgs(mousePositionGrid.X - _lastMousePositionGrid.Value.X, mousePositionGrid.Y - _lastMousePositionGrid.Value.Y); this.OwningGrid.OnColumnHeaderDragDelta(dragDeltaEventArgs); _reorderingThumb.HorizontalOffset = mousePositionGridParent.X - _dragStart.Value.X; _reorderingThumb.VerticalOffset = _dragStartParent.Value.Y - _dragStart.Value.Y; // the mouse position relative to the ColumnHeadersPresenter can be scaled differently than // the same position relative to the DataGrid, so apply the grid's RenderTransform Point scaledMousePositionHeaders = this.OwningGrid.RenderTransform.Transform(mousePositionHeaders); // prepare some variables for clipping/hiding double dgX = mousePositionGridParent.X - scaledMousePositionHeaders.X; double dgY = mousePositionGridParent.Y - scaledMousePositionHeaders.Y; double dgW = this.OwningGrid.CellsWidth; double dgH = this.OwningGrid.CellsHeight + this.OwningGrid.ColumnHeaders.ActualHeight; // we need to transform the size of the clipping rectangle if the datagrid has a rendertransform set Point clipSize = new Point(dgW, dgH); clipSize = this.OwningGrid.RenderTransform.Transform(clipSize); // clip the thumb to the column headers region _reorderingThumb.Child.Clip = new RectangleGeometry { Rect = new Rect( dgX - _reorderingThumb.HorizontalOffset, dgY - _reorderingThumb.VerticalOffset, clipSize.X, clipSize.Y ) }; // if the datagrid has a scale transform, apply the inverse to the popup's clipping rectangle ScaleTransform scaleTransform = null; ScaleTransform gridScaleTransform = _reorderingThumb.Child.RenderTransform as ScaleTransform; if (gridScaleTransform != null && gridScaleTransform.ScaleY != 0.0 && gridScaleTransform.ScaleX != 0.0) { scaleTransform = new ScaleTransform(); scaleTransform.ScaleX = 1.0 / gridScaleTransform.ScaleX; scaleTransform.ScaleY = 1.0 / gridScaleTransform.ScaleY; } if (scaleTransform != null) { _reorderingThumb.Child.Clip.Transform = scaleTransform; } // Find header we're hovering over DataGridColumn targetColumn = this.GetReorderingTargetColumn(mousePosition, true /* ignoreVertical */, true /* clipToVisible */); if (this.OwningGrid.ColumnDropLocationIndicator != null) { if (targetColumn == this.OwningGrid.ColumnsInternal.FillerColumn) { // change target column to last column but position caret at the end targetColumn = this.OwningGrid.ColumnsInternal.LastVisibleColumn; Point targetPosition = this.OwningGrid.RenderTransform.Transform(this.Translate(targetColumn.HeaderCell, mousePosition)); this.OwningGrid.ColumnDropLocationIndicatorPopup.IsOpen = true; this.OwningGrid.ColumnDropLocationIndicatorPopup.HorizontalOffset = mousePositionGridParent.X - targetPosition.X + targetColumn.HeaderCell.ActualWidth; this.OwningGrid.ColumnDropLocationIndicatorPopup.VerticalOffset = mousePositionGridParent.Y - targetPosition.Y; } else if (targetColumn != null) { // try to position caret Point targetPosition = this.OwningGrid.RenderTransform.Transform(this.Translate(targetColumn.HeaderCell, mousePosition)); this.OwningGrid.ColumnDropLocationIndicatorPopup.IsOpen = true; this.OwningGrid.ColumnDropLocationIndicatorPopup.HorizontalOffset = mousePositionGridParent.X - targetPosition.X; this.OwningGrid.ColumnDropLocationIndicatorPopup.VerticalOffset = mousePositionGridParent.Y - targetPosition.Y; } else { this.OwningGrid.ColumnDropLocationIndicatorPopup.IsOpen = false; } // hide the caret if it's off the grid -- this is not the same as clipping if (this.OwningGrid.ColumnDropLocationIndicatorPopup.HorizontalOffset < dgX || dgX + clipSize.X < this.OwningGrid.ColumnDropLocationIndicatorPopup.HorizontalOffset) { this.OwningGrid.ColumnDropLocationIndicatorPopup.IsOpen = false; } } handled = true; } #endregion }
private void DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { //thumb1.Background = Brushes.Green; }
private void DragStartHandler(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { _MoveHandler.Start(); }
private void media_slider_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { this.SliderFlag = true; }
private void Resizer_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { _dragX = 0; _dragY = 0; }
private void timelineSlider_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { isDragging = true; }
private void OnDragConnectionStart(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { CV.CompositionGraphView.ConnectionDragHelper.DoDragDropNewConnection(this, Outputs[0]); }
private void ui_SliderProgress_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { _isUserDraggingSlider = true; }
private void ProgressSlider_OnDragStarted(object sender, DragStartedEventArgs e) { viewModel.OnStartDrag(); }
protected override void OnThumbDragStarted(System.Windows.Controls.Primitives.DragStartedEventArgs e) { IsDragging = true; base.OnThumbDragStarted(e); }
private void Slider_DragStarted(object sender, DragStartedEventArgs e) { Mplayer.IsMuted = true; _dragStarted = true; }
private void VerticalThumb_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { thumbDragStarted(); }
/// <summary> /// Handles the DragStarted event of the CurrentPositionSlider control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="DragStartedEventArgs" /> instance containing the event data.</param> private void CurrentPositionSlider_DragStarted(object sender, DragStartedEventArgs e) { _isPositionSliderDragging = true; }
private void OnLeftGripDragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { this.StartDragging(ResizeGripLocation.Left); }
/// <summary> /// Callback for thumb control's DragStarted event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ResizeThumb_OnDragStarted(object sender, DragStartedEventArgs e) { //throw new NotImplementedException(); }
private void slGra_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { czySuwakJestPrzesuwany = true; }
private void MetadataItemsControl_DragStarted(object sender, DragStartedEventArgs e) { Thumb thumb = e.OriginalSource as Thumb; if (thumb != null) { this.dragging = true; } }
private void OnThumbDragStarted(object sender, DragStartedEventArgs e) { dragInitialValue = Value; e.Handled = true; }
/// <summary> /// Method which start the column header drag. Includes raising events and creating default ghosts /// </summary> private void StartColumnHeaderDrag() { Debug.Assert(ParentDataGrid != null, "ParentDataGrid is null"); _columnHeaderDragStartPosition = _columnHeaderDragCurrentPosition; DragStartedEventArgs dragStartedEventArgs = new DragStartedEventArgs(_columnHeaderDragStartPosition.X, _columnHeaderDragStartPosition.Y); ParentDataGrid.OnColumnHeaderDragStarted(dragStartedEventArgs); DataGridColumnReorderingEventArgs reorderingEventArgs = new DataGridColumnReorderingEventArgs(_draggingSrcColumnHeader.Column); _columnHeaderDragIndicator = CreateColumnHeaderDragIndicator(); _columnHeaderDropLocationIndicator = CreateColumnHeaderDropIndicator(); reorderingEventArgs.DragIndicator = _columnHeaderDragIndicator; reorderingEventArgs.DropLocationIndicator = _columnHeaderDropLocationIndicator; ParentDataGrid.OnColumnReordering(reorderingEventArgs); if (!reorderingEventArgs.Cancel) { _isColumnHeaderDragging = true; _columnHeaderDragIndicator = reorderingEventArgs.DragIndicator; _columnHeaderDropLocationIndicator = reorderingEventArgs.DropLocationIndicator; if (_columnHeaderDragIndicator != null) { SetDefaultsOnDragIndicator(); AddVisualChild(_columnHeaderDragIndicator); } if (_columnHeaderDropLocationIndicator != null) { SetDefaultsOnDropIndicator(); AddVisualChild(_columnHeaderDropLocationIndicator); } _draggingSrcColumnHeader.SuppressClickEvent = true; InvalidateMeasure(); } else { FinishColumnHeaderDrag(true); } }
private void DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { }
private void TimeSlider_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { seeking = true; }
private void OnMouseMove_Reorder(ref bool handled, Point mousePosition, Point mousePositionHeaders, Point mousePositionGrid, Point mousePositionGridParent, double distanceFromLeft, double distanceFromRight) { if (handled) { return; } #region handle entry into reorder mode if (_dragMode == DragMode.MouseDown && _dragColumn == null && (distanceFromRight > DATAGRIDCOLUMNHEADER_resizeRegionWidth && distanceFromLeft > DATAGRIDCOLUMNHEADER_resizeRegionWidth)) { DragStartedEventArgs dragStartedEventArgs = new DragStartedEventArgs(mousePositionGrid.X - _lastMousePositionGrid.Value.X, mousePositionGrid.Y - _lastMousePositionGrid.Value.Y); this.OwningGrid.OnColumnHeaderDragStarted(dragStartedEventArgs); handled = CanReorderColumn(this.OwningColumn); if (handled) { OnMouseMove_BeginReorder(mousePosition, mousePositionGridParent); } } #endregion #region handle reorder mode (eg, positioning of the popup) if (_dragMode == DragMode.Reorder && _reorderingThumb != null) { DragDeltaEventArgs dragDeltaEventArgs = new DragDeltaEventArgs(mousePositionGrid.X - _lastMousePositionGrid.Value.X, mousePositionGrid.Y - _lastMousePositionGrid.Value.Y); this.OwningGrid.OnColumnHeaderDragDelta(dragDeltaEventArgs); _reorderingThumb.HorizontalOffset = mousePositionGridParent.X - _dragStart.Value.X; _reorderingThumb.VerticalOffset = _dragStartParent.Value.Y - _dragStart.Value.Y; // the mouse position relative to the ColumnHeadersPresenter can be scaled differently than // the same position relative to the DataGrid, so we'll have to apply the grid's RenderTransform Point scaledMousePositionHeaders = mousePositionHeaders; if (!this.OwningColumn.IsFrozen) { scaledMousePositionHeaders.X -= _frozenColumnsWidth; } scaledMousePositionHeaders = this.OwningGrid.RenderTransform.Transform(scaledMousePositionHeaders); // prepare some variables for clipping/hiding double dgX = mousePositionGridParent.X - scaledMousePositionHeaders.X; double dgY = mousePositionGridParent.Y - scaledMousePositionHeaders.Y; double dgW = this.OwningColumn.IsFrozen ? _frozenColumnsWidth : this.OwningGrid.CellsWidth - _frozenColumnsWidth; double dgH = this.OwningGrid.ActualRowsPresenterHeight + this.OwningGrid.ColumnHeaders.ActualHeight; // we need to transform the size of the clipping rectangle if the datagrid has a rendertransform set Point clipSize = new Point(dgW, dgH); clipSize = this.OwningGrid.RenderTransform.Transform(clipSize); // clip the thumb to the column headers region _reorderingThumb.Child.Clip = new RectangleGeometry { Rect = new Rect( dgX - _reorderingThumb.HorizontalOffset, dgY - _reorderingThumb.VerticalOffset, clipSize.X, clipSize.Y ) }; // if the datagrid has a scale transform, apply the inverse to the popup's clipping rectangle ScaleTransform scaleTransform = null; ScaleTransform gridScaleTransform = _reorderingThumb.Child.RenderTransform as ScaleTransform; if (gridScaleTransform != null && gridScaleTransform.ScaleY != 0.0 && gridScaleTransform.ScaleX != 0.0) { scaleTransform = new ScaleTransform(); scaleTransform.ScaleX = 1.0 / gridScaleTransform.ScaleX; scaleTransform.ScaleY = 1.0 / gridScaleTransform.ScaleY; } if (scaleTransform != null) { _reorderingThumb.Child.Clip.Transform = scaleTransform; } // Find header we're hovering over DataGridColumn targetColumn = this.GetReorderingTargetColumn(mousePosition, true /* ignoreVertical */, true /* clipToVisible */); if (this.OwningGrid.ColumnDropLocationIndicator != null) { if (targetColumn == this.OwningGrid.ColumnsInternal.FillerColumn) { // change target column to last column but position caret at the end targetColumn = this.OwningGrid.ColumnsInternal.LastVisibleColumn; Point targetPosition = this.OwningGrid.RenderTransform.Transform(this.Translate(targetColumn.HeaderCell, mousePosition)); this.OwningGrid.ColumnDropLocationIndicatorPopup.IsOpen = true; this.OwningGrid.ColumnDropLocationIndicatorPopup.HorizontalOffset = mousePositionGridParent.X - targetPosition.X + targetColumn.HeaderCell.ActualWidth; this.OwningGrid.ColumnDropLocationIndicatorPopup.VerticalOffset = mousePositionGridParent.Y - targetPosition.Y; } else if (targetColumn != null) { // try to position caret Point targetPosition = this.OwningGrid.RenderTransform.Transform(this.Translate(targetColumn.HeaderCell, mousePosition)); this.OwningGrid.ColumnDropLocationIndicatorPopup.IsOpen = true; this.OwningGrid.ColumnDropLocationIndicatorPopup.HorizontalOffset = mousePositionGridParent.X - targetPosition.X; this.OwningGrid.ColumnDropLocationIndicatorPopup.VerticalOffset = mousePositionGridParent.Y - targetPosition.Y; } else { this.OwningGrid.ColumnDropLocationIndicatorPopup.IsOpen = false; } // hide the caret if it's off the grid -- this is not the same as clipping if (this.OwningGrid.ColumnDropLocationIndicatorPopup.HorizontalOffset < dgX || dgX + clipSize.X < this.OwningGrid.ColumnDropLocationIndicatorPopup.HorizontalOffset) { this.OwningGrid.ColumnDropLocationIndicatorPopup.IsOpen = false; } } handled = true; } #endregion }
protected override void OnThumbDragStarted(System.Windows.Controls.Primitives.DragStartedEventArgs e) { base.OnThumbDragStarted(e); nodeModel.Workspace.RecordModelForModification(nodeModel); (nodeModel as IBlockingModel).OnBlockingStarted(EventArgs.Empty); }
private void VideoProgessSlider_HandleSliderDragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) { model.IsPaused = true; }