Exemple #1
0
        public Axis2D() : base()
        {
            MinTransformed = GraphTransform(Min); MaxTransformed = GraphTransform(Max);
            this.Background = null;
            axisLabel.Visibility = Visibility.Collapsed;
            gridLines = new GridLines(this);
            canvas.Children.Add(axisLine); axisLine.SetValue(Canvas.ZIndexProperty, 100);
            canvas.Children.Add(axisTicks); axisTicks.SetValue(Canvas.ZIndexProperty, 100);
            canvas.Children.Add(axisLabel); axisLabel.SetValue(Canvas.ZIndexProperty, 100);
            canvas.Children.Add(interactionPad); interactionPad.SetValue(Canvas.ZIndexProperty, 50);
            Brush padFill = new SolidColorBrush() { Color = Brushes.Aquamarine.Color, Opacity = 0.0 };
            interactionPad.Fill = padFill;
            axisLine.Data = axisLineGeometry;
            axisTicks.Data = axisTicksGeometry;
            DeriveTicks();

            DependencyPropertyDescriptor fontSizeDescr = DependencyPropertyDescriptor.
                FromProperty(Control.FontSizeProperty, typeof(Axis2D));

            if (fontSizeDescr != null)
            {
                fontSizeDescr.AddValueChanged(this, delegate
                {
                    TickLabelCache.Invalidate();
                });
            } 
        }