コード例 #1
0
ファイル: RadBulletGraph.cs プロジェクト: zach14c/UI-For-UWP
        /// <summary>
        /// Retrieves the template parts of the control.
        /// </summary>
        protected override bool ApplyTemplateCore()
        {
            base.ApplyTemplateCore();

            this.qualitativeBarPart = this.GetTemplatePartField <SegmentedLinearGaugeIndicator>(QualitativeBarPartName);
            bool applied = this.qualitativeBarPart != null;

            if (applied)
            {
                foreach (BarIndicatorSegment segment in this.QualitativeRanges)
                {
                    this.qualitativeBarPart.Segments.Add(segment);
                }
                this.QualitativeRanges.Clear();
                this.QualitativeRanges = this.qualitativeBarPart.Segments;
            }

            this.comparativeMeasurePart = this.GetTemplatePartField <MarkerGaugeIndicator>(ComparativeMeasurePartName);
            applied = applied && this.comparativeMeasurePart != null;

            this.scalePart = this.GetTemplatePartField <RadLinearGauge>(ScalePartName);
            applied        = applied && this.scalePart != null;

            if (applied)
            {
                foreach (BulletGraphComparativeMeasure measure in this.AdditionalComparativeMeasures)
                {
                    this.scalePart.Indicators.Add(measure.Visual);
                    this.SyncComparativeMeasureTemplate(measure);
                }
            }

            return(applied);
        }
コード例 #2
0
        private static void OnContentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MarkerGaugeIndicator indicator = d as MarkerGaugeIndicator;

            if (indicator.IsInternalPropertyChange)
            {
                return;
            }

            indicator.isUserContent = e.NewValue != null;
        }
コード例 #3
0
        /// <summary>
        /// This is a factory method that is used to create specific visualizations for different bullet graph measures.
        /// </summary>
        /// <returns>Returns an object that will be used to visualize this measure.</returns>
        internal override GaugeIndicator CreateVisual()
        {
            MarkerGaugeIndicator result = new MarkerGaugeIndicator();

            result.SetBinding(MarkerGaugeIndicator.ContentTemplateProperty, new Binding()
            {
                Path = new PropertyPath("Template"), Source = this
            });
            Canvas.SetZIndex(result, RadBulletGraph.ComparativeMeasuresZIndex);
            return(result);
        }
コード例 #4
0
        private static void OnIsRotatedPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            MarkerGaugeIndicator indicator = sender as MarkerGaugeIndicator;

            if (!indicator.IsTemplateApplied)
            {
                return;
            }

            if (!(bool)args.NewValue)
            {
                indicator.visualElementRotation.Angle = indicator.initialRotationAngle;
            }
            indicator.UpdateRotationInLinearRange();
        }
コード例 #5
0
        private static void OnIsRotatedPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            MarkerGaugeIndicator indicator = sender as MarkerGaugeIndicator;

            if (!indicator.IsTemplateApplied)
            {
                return;
            }

            if (!(bool)args.NewValue)
            {
                indicator.visualElementRotation.Angle = indicator.initialRotationAngle;
            }
            indicator.UpdateRotationInLinearRange();

            var peer = FrameworkElementAutomationPeer.CreatePeerForElement(indicator) as MarkerGaugeIndicatorAutomationPeer;

            if (peer != null)
            {
                peer.RaiseToggleStatePropertyChangedEvent((bool)args.OldValue, (bool)args.NewValue);
            }
        }