Exemple #1
0
        private static void OnStartValuePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            GaugeIndicator indicator = sender as GaugeIndicator;

            if (indicator.IsInternalPropertyChange || indicator.Owner == null)
            {
                return;
            }

            indicator.ClampValueToRange(StartValueProperty);
            indicator.OnStartValueChanged(indicator.StartValue, (double)args.OldValue);
        }
Exemple #2
0
        /// <summary>
        /// A virtual method that is called for each indicator in the arrange layout pass.
        /// </summary>
        /// <param name="indicator">The indicator to arrange.</param>
        /// <param name="finalSize">The size in which to arrange the indicator.</param>
        /// <remarks>
        /// The rect in which the indicator will be arranged should be retrieved from
        /// the indicator itself via the GetArrangeRect() method.
        /// </remarks>
        internal override void ArrangeIndicator(GaugeIndicator indicator, Size finalSize)
        {
            Rect indicatorRect = indicator.GetArrangeRect(finalSize);

            indicator.Arrange(indicatorRect);

            Size  indicatorSize   = new Size(indicatorRect.Width, indicatorRect.Height);
            Point indicatorOffset = GetIndicatorOffset(indicatorSize, finalSize);

            Canvas.SetLeft(indicator, indicatorOffset.X);
            Canvas.SetTop(indicator, indicatorOffset.Y);
        }
Exemple #3
0
        /// <summary>
        /// A virtual method that is called when the Orientation property changes.
        /// </summary>
        /// <param name="newOrientation">The new Orientation.</param>
        /// <param name="oldOrientation">The old Orientation.</param>
        internal virtual void OnOrientationChanged(Orientation newOrientation, Orientation oldOrientation)
        {
            this.isHorizontal = newOrientation == Orientation.Horizontal;

            foreach (UIElement element in this.Indicators)
            {
                GaugeIndicator indicator = element as GaugeIndicator;
                if (indicator == null)
                {
                    continue;
                }

                RadLinearGauge.SetOrientation(indicator, newOrientation);
            }

            this.InvalidateMeasure();
        }
Exemple #4
0
        private static void OnValuePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            double newVal = (double)args.NewValue;

            RadGauge.ValidateValue(newVal);

            GaugeIndicator indicator = sender as GaugeIndicator;

            if (!indicator.IsTemplateApplied || indicator.Owner == null || indicator.IsInternalPropertyChange)
            {
                indicator.ActualValue = newVal;
                return;
            }

            indicator.ClampValueToRange(ValueProperty);

            if (indicator.isAnimationRunning)
            {
                indicator.isAnimationRunning = false;
                indicator.storyboard.Seek(new TimeSpan(0));
            }

            double value = indicator.Value;

            if (indicator.IsAnimated)
            {
                double from = (double)args.OldValue;
                StartValueAnimation(from, newVal, indicator);
            }
            else
            {
                indicator.ActualValue = value;
            }

            var peer = FrameworkElementAutomationPeer.FromElement(indicator) as GaugeIndicatorAutomationPeer;

            if (peer != null)
            {
                peer.RaiseValueChangedAutomationEvent(args.OldValue.ToString(), args.NewValue.ToString());
            }
        }
Exemple #5
0
        /// <summary>
        /// A virtual method that is called for each indicator in the arrange layout pass.
        /// </summary>
        /// <param name="indicator">The indicator to arrange.</param>
        /// <param name="finalSize">The size in which to arrange the indicator.</param>
        /// <remarks>
        /// The Rect in which the indicator will be arranged should be retrieved from
        /// the indicator itself via the GetArrangeRect() method.
        /// </remarks>
        internal virtual void ArrangeIndicator(GaugeIndicator indicator, Size finalSize)
        {
            Rect rect = indicator.GetArrangeRect(finalSize);

            indicator.Arrange(rect);
        }
Exemple #6
0
        private static void OnAnimationDurationPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            GaugeIndicator indicator = sender as GaugeIndicator;

            indicator.valueAnimation.Duration = (Duration)args.NewValue;
        }
Exemple #7
0
        private static void OnAnimationEasingPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            GaugeIndicator indicator = sender as GaugeIndicator;

            indicator.valueAnimation.EasingFunction = (EasingFunctionBase)args.NewValue;
        }