Interaction logic for HeatColorRange.xaml
コード例 #1
0
        /// <summary>
        /// Defines special elements to draw according to the series type
        /// </summary>
        public override void DrawSpecializedElements()
        {
            if (DrawsHeatRange)
            {
                if (ColorRangeControl == null)
                {
                    ColorRangeControl = new HeatColorRange();
                }

                ColorRangeControl.SetBinding(TextBlock.FontFamilyProperty,
                                             new Binding {
                    Path = new PropertyPath("FontFamily"), Source = this
                });
                ColorRangeControl.SetBinding(TextBlock.FontSizeProperty,
                                             new Binding {
                    Path = new PropertyPath("FontSize"), Source = this
                });
                ColorRangeControl.SetBinding(TextBlock.FontStretchProperty,
                                             new Binding {
                    Path = new PropertyPath("FontStretch"), Source = this
                });
                ColorRangeControl.SetBinding(TextBlock.FontStyleProperty,
                                             new Binding {
                    Path = new PropertyPath("FontStyle"), Source = this
                });
                ColorRangeControl.SetBinding(TextBlock.FontWeightProperty,
                                             new Binding {
                    Path = new PropertyPath("FontWeight"), Source = this
                });
                ColorRangeControl.SetBinding(TextBlock.ForegroundProperty,
                                             new Binding {
                    Path = new PropertyPath("Foreground"), Source = this
                });
                ColorRangeControl.SetBinding(VisibilityProperty,
                                             new Binding {
                    Path = new PropertyPath("Visibility"), Source = this
                });

                if (ColorRangeControl.Parent == null)
                {
                    Model.Chart.View.AddToView(ColorRangeControl);
                }
                var max = ColorRangeControl.SetMax(ActualValues.GetTracker(this).WLimit.Max.ToString(CultureInfo.InvariantCulture));
                var min = ColorRangeControl.SetMin(ActualValues.GetTracker(this).WLimit.Min.ToString(CultureInfo.InvariantCulture));

                var m = max > min ? max : min;

                ColorRangeControl.Width = m;

                Model.Chart.ControlSize = new CoreSize(Model.Chart.ControlSize.Width - m - 4,
                                                       Model.Chart.ControlSize.Height);
            }
            else
            {
                Model.Chart.View.RemoveFromView(ColorRangeControl);
            }
        }
コード例 #2
0
        /// <summary>
        /// Defines special elements to draw according to the series type
        /// </summary>
        public override void DrawSpecializedElements()
        {
            if (DrawsHeatRange)
            {
                if (ColorRangeControl == null)
                {
                    ColorRangeControl = new HeatColorRange();
                }

                ColorRangeControl.SetBinding(TextBlock.FontFamilyProperty,
                    new Binding {Path = new PropertyPath("FontFamily"), Source = this});
                ColorRangeControl.SetBinding(TextBlock.FontSizeProperty,
                    new Binding {Path = new PropertyPath("FontSize"), Source = this});
                ColorRangeControl.SetBinding(TextBlock.FontStretchProperty,
                    new Binding {Path = new PropertyPath("FontStretch"), Source = this});
                ColorRangeControl.SetBinding(TextBlock.FontStyleProperty,
                    new Binding {Path = new PropertyPath("FontStyle"), Source = this});
                ColorRangeControl.SetBinding(TextBlock.FontWeightProperty,
                    new Binding {Path = new PropertyPath("FontWeight"), Source = this});
                ColorRangeControl.SetBinding(TextBlock.ForegroundProperty,
                    new Binding {Path = new PropertyPath("Foreground"), Source = this});
                ColorRangeControl.SetBinding(VisibilityProperty,
                    new Binding {Path = new PropertyPath("Visibility"), Source = this});

                if (ColorRangeControl.Parent == null)
                {
                    Model.Chart.View.AddToView(ColorRangeControl);
                }
                var max = ColorRangeControl.SetMax(ActualValues.GetTracker(this).WLimit.Max.ToString(CultureInfo.InvariantCulture));
                var min = ColorRangeControl.SetMin(ActualValues.GetTracker(this).WLimit.Min.ToString(CultureInfo.InvariantCulture));

                var m = max > min ? max : min;

                ColorRangeControl.Width = m;

                Model.Chart.ControlSize = new CoreSize(Model.Chart.ControlSize.Width - m - 4,
                    Model.Chart.ControlSize.Height);
            }
            else
            {
                Model.Chart.View.RemoveFromView(ColorRangeControl);
            }
        }