Exemple #1
0
        private UIElement CreateViewForModel(PolygonModel p)
        {
            PathFigure figure   = CreatePathFigureFromPointList(p.Points);
            Geometry   geometry = CreateGeometryFromFigure(figure);
            Path       path     = CreatePathFromGeometry(geometry, p.Fill);

            return(path);
        }
Exemple #2
0
        private UIElement CreateViewForModel(PolygonModel p)
        {
            var s = new Polygon();

            foreach (var point in p.Points)
            {
                s.Points.Add(point);
            }
            s.Fill = p.Fill;
            return(s);
        }
Exemple #3
0
        private void AddShapes_Click(object sender, RoutedEventArgs e)
        {
            var p = new PolygonModel()
            {
                Fill = blueBrush
            };

            p.Points.Add(new Point(10, 10));
            p.Points.Add(new Point(50, 10));
            p.Points.Add(new Point(50, 50));
            p.Points.Add(new Point(10, 50));
            polygons.Add(p);

            this.viewShapeBased.SetModel(polygons);
            this.viewVisualBased.SetModel(polygons);
        }