HelixToolkit.Wpf.ColorAxis.AddVisuals C# (CSharp) Method

AddVisuals() protected method

Adds the visuals.
protected AddVisuals ( ) : void
return void
        protected virtual void AddVisuals()
        {
            switch (this.Position)
            {
                case ColorAxisPosition.Left:
                    this.ColorArea = new Rect(
                        this.Padding.Left,
                        this.Padding.Top,
                        this.BarWidth,
                        this.ActualHeight - this.Padding.Bottom - this.Padding.Top);
                    break;
                case ColorAxisPosition.Right:
                    this.ColorArea = new Rect(
                        this.ActualWidth - this.Padding.Right - this.BarWidth,
                        this.Padding.Top,
                        this.BarWidth,
                        this.ActualHeight - this.Padding.Bottom - this.Padding.Top);
                    break;
            }

            var r = new Rectangle
                        {
                            Fill = this.ColorScheme,
                            Width = this.ColorArea.Width,
                            Height = this.ColorArea.Height
                        };
            Canvas.SetLeft(r, this.ColorArea.Left);
            Canvas.SetTop(r, this.ColorArea.Top);
            this.Canvas.Children.Add(r);

            this.Canvas.Children.Add(
                new Line
                    {
                        Stroke = this.Foreground,
                        StrokeThickness = 1,
                        SnapsToDevicePixels = true,
                        X1 = this.ColorArea.Left,
                        Y1 = this.ColorArea.Top,
                        X2 = this.ColorArea.Left,
                        Y2 = this.ColorArea.Bottom
                    });
            this.Canvas.Children.Add(
                new Line
                    {
                        Stroke = this.Foreground,
                        StrokeThickness = 1,
                        SnapsToDevicePixels = true,
                        X1 = this.ColorArea.Right,
                        Y1 = this.ColorArea.Top,
                        X2 = this.ColorArea.Right,
                        Y2 = this.ColorArea.Bottom
                    });
        }