protected override void ExecuteScrollCommand(ScrollCommandKind command) { var commandOrientation = ScrollViewUtils.GetCommandOrientation(command); var orientation = Orientation; var orientedViewport = Viewport.AsOriented(orientation); var orientedExtent = Extent.AsOriented(orientation); var orientedOffset = Offset.AsOriented(orientation); var directScrollView = new OrientedScrollView(orientation, orientedViewport.Direct, orientedExtent.Direct, orientedOffset.Direct); var indirectScrollView = new OrientedScrollView(orientation.Rotate(), orientedViewport.Indirect, orientedExtent.Indirect, orientedOffset.Indirect); directScrollView.ExecuteScrollCommand(command, commandOrientation == orientation ? ScrollViewUtils.DefaultUnitSmallChange : ScrollViewUtils.DefaultPixelSmallChange, commandOrientation == orientation ? ScrollViewUtils.DefaultUnitWheelChange : ScrollViewUtils.DefaultPixelWheelChange); indirectScrollView.ExecuteScrollCommand(command, commandOrientation != orientation ? ScrollViewUtils.DefaultUnitSmallChange : ScrollViewUtils.DefaultPixelSmallChange, commandOrientation != orientation ? ScrollViewUtils.DefaultUnitWheelChange : ScrollViewUtils.DefaultPixelWheelChange); orientedOffset.Direct = directScrollView.Offset; orientedOffset.Indirect = indirectScrollView.Offset; Offset = orientedOffset.Vector; }
private Vector CalcBringIntoViewOffset(int index, BringIntoViewMode mode, Size viewport, Size extent, Vector offset) { if (index < 0 || index >= ItemsCount) { return(offset); } var orientation = Orientation; var orientedViewPort = viewport.AsOriented(orientation); var orientedExtent = extent.AsOriented(orientation); var orientedOffset = offset.AsOriented(orientation); var orientedViewer = new OrientedScrollView(orientation, orientedViewPort.Direct, orientedExtent.Direct, orientedOffset.Direct); orientedViewer.Offset = orientedViewer.Offset - index > 0.0 || mode == BringIntoViewMode.Top ? index : index - orientedViewer.Viewport + 1.0; orientedOffset.Direct = orientedViewer.Offset; return(orientedOffset.Vector); }