Exemple #1
0
        void Item_Selected(object sender, RoutedEventArgs e)
        {
            var item  = sender as ListBoxItem;
            var model = item.Tag as string;

            ModelEditor.Clear(Editor.Context.CurrentCanvas);
            ModelEditor.Parse(model,
                              Editor.Context.CurrentCanvas,
                              Editor.Context.DiagramCreator,
                              0, 0,
                              false, true, false, true);
        }
        private FrameworkElement CreateDiagramElement(string diagram,
                                                      Size areaExtent,
                                                      Point origin,
                                                      Rect area,
                                                      bool fixedStrokeThickness,
                                                      ResourceDictionary resources,
                                                      DiagramTable table)
        {
            var grid = new Grid()
            {
                ClipToBounds = true,
                Resources    = resources
            };

            var template = new Control()
            {
                Template = grid.Resources[ResourceConstants.KeyLandscapePageTemplate] as ControlTemplate
            };

            var canvas = new DiagramCanvas()
            {
                Width  = PageWidth,
                Height = PageHeight
            };

            ModelEditor.Parse(diagram,
                              canvas, this.DiagramCreator,
                              0, 0,
                              false, false, false, true);

            grid.Children.Add(template);
            grid.Children.Add(canvas);

            LineEx.SetShortenStart(grid, ShortenStart);
            LineEx.SetShortenEnd(grid, ShortenEnd);

            TableGrid.SetData(grid, table);

            return(grid);
        }