Пример #1
0
        /// <summary>
        /// Method called to clamp the ContentOffset X or Y value to its valid range.
        /// </summary>
        /// <param name="pObject">The modified control.</param>
        /// <param name="pBaseValue">The value to coerce.</param>
        private static object OnCoerceContentOffset(DependencyObject pObject, object pBaseValue)
        {
            TooledZoomAndPanControl lControl = pObject as TooledZoomAndPanControl;

            if (lControl != null)
            {
                double lValue      = System.Convert.ToDouble(pBaseValue);
                double lMinOffsetX = 0.0;
                lValue = Math.Max(lValue, lMinOffsetX);
                return(lValue);
            }

            return(pBaseValue);
        }
Пример #2
0
        /// <summary>
        /// Method called when the control template is applied.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // Getting the parts of the control.
            this.mZoomAndPanControl = this.GetTemplateChild(PART_ZOOM_AND_PAN_CONTROL) as TooledZoomAndPanControl;
            this.mSimpleGraphView = this.GetTemplateChild(PART_SIMPLE_GRAPH_VIEW) as SimpleGraphView;
            this.mOverview = this.GetTemplateChild(PART_OVERVIEW) as SimpleGraphView;

            if (this.mZoomAndPanControl == null || this.mSimpleGraphView == null || this.mOverview == null)
            {
                throw new Exception("GraphView control template not correctly defined.");
            }

            this.mSimpleGraphView.SelectionChanged += this.OnSimpleGraphViewSelectionChanged;
        }