private void ColumnsGrid_ManipulationDelta(object sender, ManipulationDeltaEventArgs e) { double prefScaleFactor = InternalScaleFactor; double scaleFactor = e.DeltaManipulation.Scale.Y; if (scaleFactor != 1.0) { InternalScaleFactor *= scaleFactor; //System.Diagnostics.Debug.WriteLine("scale changed by {0:0.0000} to {1:0.##}", scaleFactor, InternalScaleFactor); } double newScaleFactor = InternalScaleFactor; //System.Diagnostics.Debug.WriteLine("scale changed by {2} to {0}, trandlation changed to {1}", InternalScaleFactor, e.DeltaManipulation.Translation.Y,factor); var wpfMo = ColumnsGrid.PointFromScreen(new Point(0.0, e.ManipulationOrigin.Y));//as manipulation origin is in screen coods double mo = wpfMo.Y; double startOffset = GridScroll.VerticalOffset; double shift = -e.DeltaManipulation.Translation.Y; //double startOffsetInScreen = ColumnsGrid.PointToScreen(new Point(0.0, GridScroll.VerticalOffset)).Y; //double endOffsetInScreen = startOffset/prefScaleFactor + shi; double endOffsetInWPF = scaleFactor * (startOffset + shift); //double newOffset1 = (startOffset-mo+shift)*scaleFactor + mo; //System.Diagnostics.Debug.WriteLine("screen mo is {0}; offset {1}l wpf mo is {2}",mo,startOffset, wpfMo.Y); GridScroll.ScrollToVerticalOffset(endOffsetInWPF); e.Handled = true; }
private void ColumnsGrid_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { dragColumn = (String)ColumnsGrid.CurrentCell.Value; if (dragColumn != null) { ColumnsGrid.DoDragDrop(dragColumn, DragDropEffects.Copy); } } }