Example #1
0
        /// <summary>
        /// Event raised when the 'ContentOffsetX' property has changed value.
        /// </summary>
        /// <param name="pObject">The modified control.</param>
        /// <param name="pEventArgs">The event arguments.</param>
        private static void OnContentOffsetXChanged(DependencyObject pObject, DependencyPropertyChangedEventArgs pEventArgs)
        {
            ZoomAndPanControl lControl = pObject as ZoomAndPanControl;

            if (lControl != null)
            {
                lControl.UpdateTranslationX();

                if (lControl.mDisableContentFocusSync == false)
                {
                    // Normally want to automatically update content focus when content offset changes.
                    // Although this is disabled using 'disableContentFocusSync' when content offset changes due to in-progress zooming.
                    lControl.UpdateContentZoomFocusX();
                }

                if (lControl.mDisableScrollOffsetSync == false && lControl.ScrollOwner != null)
                {
                    // Notify the owning ScrollViewer that the scrollbar offsets should be updated.
                    lControl.ScrollOwner.InvalidateScrollInfo();
                }
            }
        }