Beispiel #1
0
        private static FrameworkElement ToPath(Geometry geometry)
        {
            var p = new Path {
                Data = geometry, Stretch = Stretch.Uniform
            };

            p.SetBinding(Shape.FillProperty, new Binding {
                Path = new PropertyPath(TextBlock.ForegroundProperty), RelativeSource = RelativeSource.Self
            });
            return(p);
        }
Beispiel #2
0
        private void Draw()
        {
            IsDrawn = true;

            Map.Children.Clear();

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                Map.Children.Add(new TextBlock
                {
                    Text       = "Designer preview is not currently available",
                    Foreground = Brushes.White,
                    FontWeight = FontWeights.Bold,
                    FontSize   = 12,
                    Effect     = new DropShadowEffect
                    {
                        ShadowDepth   = 2,
                        RenderingBias = RenderingBias.Performance
                    }
                });
                return;
            }

            var map = MapResolver.Get(Source);

            if (map == null)
            {
                return;
            }

            var desiredSize = new Size(map.DesiredWidth, map.DesiredHeight);
            var r           = desiredSize.Width / desiredSize.Height;

            var    wr = ActualWidth / desiredSize.Width;
            var    hr = ActualHeight / desiredSize.Height;
            double s;

            if (wr < hr)
            {
                IsWidthDominant = true;
                Map.Width       = ActualWidth;
                Map.Height      = Map.Width / r;
                s = wr;
                OriginalPosition = new Point(0, (ActualHeight - Map.Height) * .5);
                Canvas.SetLeft(Map, OriginalPosition.X);
                Canvas.SetTop(Map, OriginalPosition.Y);
            }
            else
            {
                IsWidthDominant = false;
                Map.Height      = ActualHeight;
                Map.Width       = r * ActualHeight;
                s = hr;
                OriginalPosition = new Point((ActualWidth - Map.Width) * .5, 0d);
                Canvas.SetLeft(Map, OriginalPosition.X);
                Canvas.SetTop(Map, OriginalPosition.Y);
            }

            var t = new ScaleTransform(s, s);

            foreach (var land in map.Data)
            {
                var p = new Path
                {
                    Data            = Geometry.Parse(land.Data),
                    RenderTransform = t
                };

                land.Shape     = p;
                Lands[land.Id] = land;
                Map.Children.Add(p);

                p.MouseEnter += POnMouseEnter;
                p.MouseLeave += POnMouseLeave;
                p.MouseMove  += POnMouseMove;
                p.MouseDown  += POnMouseDown;

                p.SetBinding(Shape.StrokeProperty,
                             new Binding {
                    Path = new PropertyPath(LandStrokeProperty), Source = this
                });
                p.SetBinding(Shape.StrokeThicknessProperty,
                             new MultiBinding
                {
                    Converter = new ScaleStrokeConverter(),
                    Bindings  =
                    {
                        new Binding("LandStrokeThickness")
                        {
                            Source = this
                        },
                        new Binding("ScaleX")
                        {
                            Source = t
                        }
                    }
                });
            }

            ShowMeSomeHeat();
        }
		private void UpdateUIRepresentation()
		{
			if (Plotter2D == null)
				return;

			foreach (var path in addedPaths)
			{
				content.Children.Remove(path);
			}
			addedPaths.Clear();

			if (DataSource == null)
			{
				labelGrid.Visibility = Visibility.Hidden;
				return;
			}

			Rect output = Plotter2D.Viewport.Output;

			Point mousePos = Mouse.GetPosition(this);
			if (!output.Contains(mousePos)) return;

			var transform = Plotter2D.Viewport.Transform;
			Point visiblePoint = mousePos.ScreenToData(transform);
			DataRect visible = Plotter2D.Viewport.Visible;

			double isolineLevel;
			if (Search(visiblePoint, out isolineLevel))
			{
				var collection = IsolineBuilder.BuildIsoline(isolineLevel);

				string format = "G3";
				if (Math.Abs(isolineLevel) < 1000)
					format = "F";

				textBlock.Text = isolineLevel.ToString(format);

				double x = mousePos.X + labelShift.X;
				if (x + labelGrid.ActualWidth > output.Right)
					x = mousePos.X - labelShift.X - labelGrid.ActualWidth;
				double y = mousePos.Y - labelShift.Y - labelGrid.ActualHeight;
				if (y < output.Top)
					y = mousePos.Y + labelShift.Y;

				Canvas.SetLeft(labelGrid, x);
				Canvas.SetTop(labelGrid, y);

				foreach (LevelLine segment in collection.Lines)
				{
					StreamGeometry streamGeom = new StreamGeometry();
					using (StreamGeometryContext context = streamGeom.Open())
					{
						Point startPoint = segment.StartPoint.DataToScreen(transform);
						var otherPoints = segment.OtherPoints.DataToScreenAsList(transform);
						context.BeginFigure(startPoint, false, false);
						context.PolyLineTo(otherPoints, true, true);
					}

					Path path = new Path
					{
						Stroke = new SolidColorBrush(Palette.GetColor(segment.Value01)),
						Data = streamGeom,
						Style = pathStyle
					};
					content.Children.Add(path);
					addedPaths.Add(path);

					labelGrid.Visibility = Visibility.Visible;

					Binding pathBinding = new Binding { Path = new PropertyPath("StrokeThickness"), Source = this };
					path.SetBinding(Path.StrokeThicknessProperty, pathBinding);
				}
			}
			else
			{
				labelGrid.Visibility = Visibility.Hidden;
			}
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="AngularGauge"/> class.
        /// </summary>
        public AngularGauge()
        {
            Canvas = new Canvas();
            Content = Canvas;

            StickRotateTransform = new RotateTransform(180);
            Stick = new Path
            {
                Data = Geometry.Parse("m0,90 a5,5 0 0 0 20,0 l-8,-88 a2,2 0 0 0 -4 0 z"),
                Fill = Brushes.CornflowerBlue,
                Stretch = Stretch.Fill,
                RenderTransformOrigin = new Point(0.5, 0.9),
                RenderTransform = StickRotateTransform
            };
            Canvas.Children.Add(Stick);
            Panel.SetZIndex(Stick, 1);

            Canvas.SetBinding(WidthProperty,
                new Binding { Path = new PropertyPath(ActualWidthProperty), Source = this });
            Canvas.SetBinding(HeightProperty,
                new Binding { Path = new PropertyPath(ActualHeightProperty), Source = this });

            SetCurrentValue(SectionsProperty, new List<AngularSection>());
            SetCurrentValue(NeedleFillProperty, new SolidColorBrush(Color.FromRgb(69, 90, 100)));

            Stick.SetBinding(Shape.FillProperty,
                new Binding {Path = new PropertyPath(NeedleFillProperty), Source = this});

            SetCurrentValue(AnimationsSpeedProperty, TimeSpan.FromMilliseconds(500));
            SetCurrentValue(TicksForegroundProperty, new SolidColorBrush(Color.FromRgb(210, 210, 210)));
            Func<double, string> defaultFormatter = x => x.ToString(CultureInfo.InvariantCulture);
            SetCurrentValue(LabelFormatterProperty, defaultFormatter);
            SetCurrentValue(LabelsEffectProperty,
                new DropShadowEffect {ShadowDepth = 2, RenderingBias = RenderingBias.Performance});

            SizeChanged += (sender, args) =>
            {
                IsControlLaoded = true;
                Draw();
            };

            Slices = new Dictionary<AngularSection, PieSlice>();
        }
Beispiel #5
0
        public LineGraph() {
            if(Settings == null)
                Settings = new LineGraphSettings();
            filters.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(filters_CollectionChanged);
            path = new Path();
            geom = new PathGeometry();
            figures = new PathFigureCollection();
            figure = new PathFigure();
            segments = new PathSegmentCollection();
            figure.Segments = segments;
            figures.Add(figure);
            geom.Figures = figures;
            path.Data = geom;
            path.StrokeLineJoin = PenLineJoin.Round;
            path.StrokeThickness = settings.LineThickness;

        
            path.SetBinding(Path.StrokeProperty, new System.Windows.Data.Binding() { Source = this, Path = new PropertyPath("LineColor") });
            Filters.Add(new Microsoft.Research.DynamicDataDisplay.Filters.FrequencyFilter());
        }
Beispiel #6
0
        public dynConnector(dynPort port, Canvas workBench, Point mousePt)
        {
            //don't allow connections to start at an input port
            if (port.PortType != PortType.INPUT)
            {
                //get start point
                //this.workBench = workBench;
                pStart = port;

                pStart.Connect(this);

                BrushConverter bc = new BrushConverter();
                strokeBrush = (Brush)bc.ConvertFrom("#313131");

                #region bezier creation
                connector = new Path();
                connector.Stroke = strokeBrush;
                connector.StrokeThickness = STROKE_THICKNESS;
                connector.Opacity = STROKE_OPACITY;

                connector.DataContext = this;
                Binding strokeBinding = new Binding("StrokeBrush");
                connector.SetBinding(Path.StrokeProperty, strokeBinding);

                DoubleCollection dashArray = new DoubleCollection();
                dashArray.Add(5); dashArray.Add(2);
                connector.StrokeDashArray = dashArray;

                PathGeometry connectorGeometry = new PathGeometry();
                connectorPoints = new PathFigure();
                connectorCurve = new BezierSegment();

                connectorPoints.StartPoint = new Point(pStart.Center.X, pStart.Center.Y);
                connectorCurve.Point1 = connectorPoints.StartPoint;
                connectorCurve.Point2 = connectorPoints.StartPoint;
                connectorCurve.Point3 = connectorPoints.StartPoint;

                connectorPoints.Segments.Add(connectorCurve);
                connectorGeometry.Figures.Add(connectorPoints);
                connector.Data = connectorGeometry;
                workBench.Children.Add(connector);
                #endregion

                #region polyline creation
                plineConnector = new Path();
                plineConnector.Stroke = strokeBrush;
                plineConnector.StrokeThickness = STROKE_THICKNESS;
                plineConnector.Opacity = STROKE_OPACITY;
                plineConnector.StrokeDashArray = dashArray;

                PathGeometry plineGeometry = new PathGeometry();
                //http://msdn.microsoft.com/en-us/library/system.windows.media.polylinesegment(v=vs.85).aspx
                plineFigure = new PathFigure();
                plineFigure.StartPoint = connectorPoints.StartPoint;
                Point[] polyLinePointArray = new Point[] { connectorPoints.StartPoint,
                connectorPoints.StartPoint,
                connectorPoints.StartPoint};
                pline = new PolyLineSegment(polyLinePointArray, true);
                pline.Points = new PointCollection(polyLinePointArray);
                plineFigure.Segments.Add(pline);
                plineGeometry.Figures.Add(plineFigure);
                plineConnector.Data = plineGeometry;
                dynSettings.Workbench.Children.Add(plineConnector);
                #endregion

                endDot = new Ellipse();
                endDot.Height = 6;
                endDot.Width = 6;
                endDot.Fill = Brushes.Black;
                endDot.StrokeThickness = 2;
                endDot.Stroke = Brushes.Black;
                endDot.IsHitTestVisible = false;
                endDot.MouseDown += new System.Windows.Input.MouseButtonEventHandler(endDot_MouseDown);
                Canvas.SetTop(endDot, connectorCurve.Point3.Y - END_DOT_SIZE / 2);
                Canvas.SetLeft(endDot, connectorCurve.Point3.X - END_DOT_SIZE / 2);
                dynSettings.Workbench.Children.Add(endDot);
                endDot.Opacity = STROKE_OPACITY;

                connector.MouseEnter += delegate { if (pEnd != null) Highlight(); };
                connector.MouseLeave += delegate { Unhighlight(); };
                plineConnector.MouseEnter += delegate { if (pEnd != null) Highlight(); };
                plineConnector.MouseLeave += delegate { Unhighlight(); };

                isDrawing = true;

                //set this to not draggable
                Dynamo.Controls.DragCanvas.SetCanBeDragged(this, false);
                Dynamo.Controls.DragCanvas.SetCanBeDragged(connector, false);

                //set the z order to the front
                Canvas.SetZIndex(connector, 0);
                Canvas.SetZIndex(endDot, 1);

                ConnectorType = dynSettings.Bench.ConnectorType;

            }
            else
            {
                throw new InvalidPortException();
            }
        }
Beispiel #7
0
        public dynConnector(dynNodeUI start, dynNodeUI end, int startIndex, int endIndex, int portType, bool visible)
        {
            //don't try to create a connector with a bad start,
            //end, or if we're trying to connector the same
            //port to itself.
            if (start == null || end == null || start == end)
            {
                throw new Exception("Attempting to create connector with invalid start or end nodes.");
            }

            pStart = start.OutPorts[startIndex];

            dynPort endPort = null;

            if (portType == 0)
                endPort = end.InPorts[endIndex];

            //connect the two ports
            //get start point

            pStart.Connect(this);

            BrushConverter bc = new BrushConverter();
            strokeBrush = (Brush)bc.ConvertFrom("#313131");

            #region bezier creation
            connector = new Path();
            connector.Stroke = strokeBrush;
            connector.StrokeThickness = STROKE_THICKNESS;
            connector.Opacity = STROKE_OPACITY;

            connector.DataContext = this;
            Binding strokeBinding = new Binding("StrokeBrush");
            connector.SetBinding(Path.StrokeProperty, strokeBinding);

            DoubleCollection dashArray = new DoubleCollection();
            dashArray.Add(5); dashArray.Add(2);
            connector.StrokeDashArray = dashArray;

            PathGeometry connectorGeometry = new PathGeometry();
            connectorPoints = new PathFigure();
            connectorCurve = new BezierSegment();

            connectorPoints.StartPoint = new Point(pStart.Center.X, pStart.Center.Y);
            connectorCurve.Point1 = connectorPoints.StartPoint;
            connectorCurve.Point2 = connectorPoints.StartPoint;
            connectorCurve.Point3 = connectorPoints.StartPoint;

            connectorPoints.Segments.Add(connectorCurve);
            connectorGeometry.Figures.Add(connectorPoints);
            connector.Data = connectorGeometry;
            dynSettings.Workbench.Children.Add(connector);
            #endregion

            #region polyline creation
            plineConnector = new Path();
            plineConnector.Stroke = strokeBrush;
            plineConnector.StrokeThickness = STROKE_THICKNESS;
            plineConnector.Opacity = STROKE_OPACITY;
            plineConnector.StrokeDashArray = dashArray;

            PathGeometry plineGeometry = new PathGeometry();
            //http://msdn.microsoft.com/en-us/library/system.windows.media.polylinesegment(v=vs.85).aspx
            plineFigure = new PathFigure();
            plineFigure.StartPoint = new Point(pStart.Center.X, pStart.Center.Y);
            Point[] polyLinePointArray = new Point[] { connectorPoints.StartPoint,
                connectorPoints.StartPoint,
                connectorPoints.StartPoint};
            pline = new PolyLineSegment(polyLinePointArray, true);
            pline.Points = new PointCollection(polyLinePointArray);
            plineFigure.Segments.Add(pline);
            plineGeometry.Figures.Add(plineFigure);
            plineConnector.Data = plineGeometry;
            dynSettings.Workbench.Children.Add(plineConnector);
            #endregion

            endDot = new Ellipse();
            endDot.Height = 6;
            endDot.Width = 6;
            endDot.Fill = Brushes.Black;
            endDot.StrokeThickness = 2;
            endDot.Stroke = Brushes.Black;
            endDot.IsHitTestVisible = false;
            endDot.MouseDown +=new System.Windows.Input.MouseButtonEventHandler(endDot_MouseDown);
            Canvas.SetTop(endDot, connectorCurve.Point3.Y - END_DOT_SIZE / 2);
            Canvas.SetLeft(endDot, connectorCurve.Point3.X - END_DOT_SIZE / 2);
            dynSettings.Workbench.Children.Add(endDot);
            endDot.Opacity = STROKE_OPACITY;
            endDot.IsHitTestVisible = false;
            endDot.MouseDown += new System.Windows.Input.MouseButtonEventHandler(endDot_MouseDown);

            this.Visible = visible;

            connector.MouseEnter += delegate { if (pEnd != null) Highlight(); };
            connector.MouseLeave += delegate { Unhighlight(); };
            plineConnector.MouseEnter += delegate { if (pEnd != null) Highlight(); };
            plineConnector.MouseLeave += delegate { Unhighlight(); };

            isDrawing = true;

            //set this to not draggable
            Dynamo.Controls.DragCanvas.SetCanBeDragged(this, false);
            Dynamo.Controls.DragCanvas.SetCanBeDragged(connector, false);

            //set the z order to the front
            //Canvas.SetZIndex(this, 300);
            Canvas.SetZIndex(this, 1);

            this.Connect(endPort);

            ConnectorType = dynSettings.Bench.ConnectorType;
        }
Beispiel #8
0
        /// <inheritdoc/>
        protected override UIElement OnGetLegendSymbol()
        {
            var grid = new Grid
            {
                MinWidth = 16,
                MinHeight = 16
            };

            if (Filled)
            {
                var area = new Path { Width = 16, Height = 16 };
                area.SetBinding(StyleProperty, new Binding("AreaStyle") { Source = this });
                var areaRectangle = new RectangleGeometry { Rect = new Rect(0, 8, 16, 8) };
                area.Data = areaRectangle;
                grid.Children.Add(area);
            }

            var line = new Path { Width = 16, Height = 16 };
            line.SetBinding(StyleProperty, new Binding("LineStyle") { Source = this });
            var lineGeometry = new LineGeometry { StartPoint = new Point(0, 8), EndPoint = new Point(16, 8) };
            line.Data = lineGeometry;
            grid.Children.Add(line);

            if (DataPointTemplate != null)
            {
                var legendSymbol = CreateDataPoint(null);
                if (legendSymbol != null)
                {
                    legendSymbol.HorizontalAlignment = HorizontalAlignment.Center;
                    legendSymbol.VerticalAlignment = VerticalAlignment.Center;
                    legendSymbol.IsHitTestVisible = false;
                    grid.Children.Add(legendSymbol);
                }
            }

            return grid;
        }
        /// <summary> 
        /// Creates one marker and wraps it up in an adorner
        /// </summary> 
        /// <param name="geometry">marker geometry</param>
        /// <returns>The MarkerComponent</returns>
        private Path CreateMarker(Geometry geometry)
        { 

            Path marker = new Path(); 
            marker.Data = geometry; 

            //set activation binding 
            Binding markerStroke = new Binding("MarkerBrushProperty");
            markerStroke.Source = this;
            marker.SetBinding(Path.StrokeProperty, markerStroke);
            Binding markerStrokeThickness = new Binding("StrokeThicknessProperty"); 
            markerStrokeThickness.Source = this;
            marker.SetBinding(Path.StrokeThicknessProperty, markerStrokeThickness); 
            marker.StrokeEndLineCap = PenLineCap.Round; 
            marker.StrokeStartLineCap = PenLineCap.Round;
            Children.Add(marker); 

            return marker;

        } 
Beispiel #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GeometryChangeListener"/> class and creates the binding with the geometry of the path.
 /// </summary>
 /// <param name="path">The path.</param>
 public GeometryChangeListener(Path path)
 {
     var binding = new Binding("Geometry") { Mode = BindingMode.TwoWay, Source = this }; // might be OneWayToSource with WPF
     path.SetBinding(Path.DataProperty, binding);
 }
Beispiel #11
0
        /// <inheritdoc/>
        protected override UIElement OnGetLegendSymbol()
        {
            var grid = new Grid
            {
                MinWidth = 16,
                MinHeight = 16,
            };

            double paletteIndex = 1;
            if (FillPalette != null && FillPalette.Count > 0)
                paletteIndex = FillPalette[FillPalette.Count - 1].Value;
            else if (StrokePalette != null && StrokePalette.Count > 0)
                paletteIndex = StrokePalette[StrokePalette.Count - 1].Value;

            Brush fillBrush;
            Brush strokeBrush;
            OnGetStrokeAndFillForLegendSymbol(paletteIndex, out strokeBrush, out fillBrush);

            if (Filled)
            {
                var area = new Path { Width = 16, Height = 16 };
                area.SetBinding(StyleProperty, new Binding("AreaStyle") { Source = this });
                var areaFigure = new PathFigure { StartPoint = new Point(0, 16) };
                areaFigure.Segments.Add(new LineSegment { Point = new Point(0, 12) });
                areaFigure.Segments.Add(new LineSegment { Point = new Point(16, 4) });
                areaFigure.Segments.Add(new LineSegment { Point = new Point(16, 16) });
                var areaGeometry = new PathGeometry();
                areaGeometry.Figures.Add(areaFigure);
                area.Data = areaGeometry;
                if (fillBrush != null)
                    area.Fill = fillBrush;
                grid.Children.Add(area);
            }

            var line = new Path { Width = 16, Height = 16 };
            line.SetBinding(StyleProperty, new Binding("LineStyle") { Source = this });
            var lineGeometry = new LineGeometry { StartPoint = new Point(0, 12), EndPoint = new Point(16, 4) };
            line.Data = lineGeometry;
            if (strokeBrush != null)
                line.Stroke = strokeBrush;
            grid.Children.Add(line);

            if (DataPointTemplate != null)
            {
                var legendSymbol = CreateDataPoint(null);
                if (legendSymbol != null)
                {
                    legendSymbol.HorizontalAlignment = HorizontalAlignment.Center;
                    legendSymbol.VerticalAlignment = VerticalAlignment.Center;
                    legendSymbol.IsHitTestVisible = false;
                    grid.Children.Add(legendSymbol);
                }
            }

            return grid;
        }
Beispiel #12
0
        private void Draw()
        {
            IsDrawn = true;

            Map.Children.Clear();

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                Map.Children.Add(new TextBlock
                {
                    Text = "Designer preview is not currently available",
                    Foreground = Brushes.White,
                    FontWeight = FontWeights.Bold,
                    FontSize = 12,
                    Effect = new DropShadowEffect
                    {
                        ShadowDepth = 2,
                        RenderingBias = RenderingBias.Performance
                    }
                });
                return;
            }

            var map = MapResolver.Get(Source);
            if (map == null) return;

            var desiredSize = new Size(map.DesiredWidth, map.DesiredHeight);
            var r = desiredSize.Width/desiredSize.Height;

            var wr = ActualWidth/desiredSize.Width;
            var hr = ActualHeight/desiredSize.Height;
            double s;

            if (wr < hr)
            {
                IsWidthDominant = true;
                Map.Width = ActualWidth;
                Map.Height = Map.Width/r;
                s = wr;
                OriginalPosition = new Point(0, (ActualHeight - Map.Height)*.5);
                Canvas.SetLeft(Map, OriginalPosition.X);
                Canvas.SetTop(Map, OriginalPosition.Y);
            }
            else
            {
                IsWidthDominant = false;
                Map.Height = ActualHeight;
                Map.Width = r*ActualHeight;
                s = hr;
                OriginalPosition = new Point((ActualWidth - Map.Width)*.5, 0d);
                Canvas.SetLeft(Map, OriginalPosition.X);
                Canvas.SetTop(Map, OriginalPosition.Y);
            }

            var t = new ScaleTransform(s, s);

            foreach (var land in map.Data)
            {
                var p = new Path
                {
                    Data = Geometry.Parse(land.Data),
                    RenderTransform = t
                };

                land.Shape = p;
                Lands[land.Id] = land;
                Map.Children.Add(p);

                p.MouseEnter += POnMouseEnter;
                p.MouseLeave += POnMouseLeave;
                p.MouseMove += POnMouseMove;
                p.MouseDown += POnMouseDown;

                p.SetBinding(Shape.StrokeProperty,
                    new Binding { Path = new PropertyPath(LandStrokeProperty), Source = this });
                p.SetBinding(Shape.StrokeThicknessProperty,
                    new MultiBinding
                    {
                        Converter = new ScaleStrokeConverter(),
                        Bindings =
                        {
                            new Binding("LandStrokeThickness") {Source = this},
                            new Binding("ScaleX") {Source = t}
                        }
                    });

            }

            ShowMeSomeHeat();
        }
Beispiel #13
0
        /// <inheritdoc/>
        protected override UIElement OnGetLegendSymbol()
        {
            var grid = new Grid
            {
                MinWidth = 16,
                MinHeight = 16,
            };

            if (HorizontalMajorLineStyle != null)
            {
                var horizontalMajorLines = new Path { Width = 16, Height = 16, Stretch = Stretch.Uniform };
                horizontalMajorLines.SetBinding(StyleProperty, new Binding("HorizontalMajorLineStyle") { Source = this });
                using (var renderContext = new PathRenderer(horizontalMajorLines).Open())
                {
                    renderContext.DrawLine(new Point(0, 0), new Point(16, 0));
                    renderContext.DrawLine(new Point(0, 8), new Point(16, 8));
                    renderContext.DrawLine(new Point(0, 16), new Point(16, 16));
                }
                grid.Children.Add(horizontalMajorLines);
            }

            if (HorizontalMinorLineStyle != null)
            {
                var horizontalMinorLines = new Path { Width = 16, Height = 16, Stretch = Stretch.Uniform };
                horizontalMinorLines.SetBinding(StyleProperty, new Binding("HorizontalMinorLineStyle") { Source = this });
                using (var renderContext = new PathRenderer(horizontalMinorLines).Open())
                {
                    renderContext.DrawLine(new Point(0, 4), new Point(16, 4));
                    renderContext.DrawLine(new Point(0, 12), new Point(16, 12));
                }
                grid.Children.Add(horizontalMinorLines);
            }

            if (VerticalMajorLineStyle != null)
            {
                var verticalMajorLines = new Path { Width = 16, Height = 16, Stretch = Stretch.Uniform };
                verticalMajorLines.SetBinding(StyleProperty, new Binding("VerticalMajorLineStyle") { Source = this });
                using (var renderContext = new PathRenderer(verticalMajorLines).Open())
                {
                    renderContext.DrawLine(new Point(0, 0), new Point(0, 16));
                    renderContext.DrawLine(new Point(8, 0), new Point(8, 16));
                    renderContext.DrawLine(new Point(16, 0), new Point(16, 16));
                }
                grid.Children.Add(verticalMajorLines);
            }

            if (VerticalMinorLineStyle != null)
            {
                var verticalMinorLines = new Path { Width = 16, Height = 16, Stretch = Stretch.Uniform };
                verticalMinorLines.SetBinding(StyleProperty, new Binding("VerticalMinorLineStyle") { Source = this });
                using (var renderContext = new PathRenderer(verticalMinorLines).Open())
                {
                    renderContext.DrawLine(new Point(4, 0), new Point(4, 16));
                    renderContext.DrawLine(new Point(12, 0), new Point(12, 16));
                }
                grid.Children.Add(verticalMinorLines);
            }

            return grid;
        }