示例#1
0
 void RegisterCustomShapes()
 {
     using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("XtraDiagram.CreateCustomShapes.CustomShapes.xml")) {
         var stencil = DiagramStencil.Create("CustomShapes", "Custom Shapes", stream, shapeName => shapeName);
         DiagramToolboxRegistrator.RegisterStencil(stencil);
     }
 }
        void RegisterContentItemTools()
        {
            DiagramStencil stencil = new DiagramStencil("CustomTools", "Content Item Tools");

            stencil.RegisterTool(new FactoryItemTool(
                                     "Text",
                                     () => "Text",
                                     diagram => new DiagramContentItem()
            {
                CustomStyleId = "formattedTextContentItem"
            },
                                     new Size(230, 110), true));
            stencil.RegisterTool(new FactoryItemTool(
                                     "Logo",
                                     () => "Logo",
                                     diagram => new DiagramContentItem()
            {
                CustomStyleId = "devExpressLogoContentItem",
            },
                                     new Size(230, 80), true));
            stencil.RegisterTool(new FactoryItemTool(
                                     "Action",
                                     () => "Button",
                                     diagram => new DiagramContentItem()
            {
                CustomStyleId = "buttonContentItem",
            },
                                     new Size(230, 80), true));
            DiagramToolboxRegistrator.RegisterStencil(stencil);
        }
示例#3
0
        void RegisterCustomShapes()
        {
            var shapesDictionary = new ResourceDictionary()
            {
                Source = new Uri("DiagramResources.xaml", UriKind.RelativeOrAbsolute)
            };
            var stencil = DiagramStencil.Create("CustomShapes", "Custom Shapes", shapesDictionary, shapeName => shapeName);

            DiagramToolboxRegistrator.RegisterStencil(stencil);
        }
示例#4
0
        protected override void RegisterCustomToolboxItems()
        {
            var dashboardStencil = new DiagramStencil(OfficeStencilId, () => "Office Shapes");

            foreach (var tool in GetResourcesTools())
            {
                dashboardStencil.RegisterTool(tool);
            }
            DiagramToolboxRegistrator.RegisterStencil(dashboardStencil);
        }
        void InitCustomDiagramShapes()
        {
            ResourceDictionary customShapesDictionary = new ResourceDictionary()
            {
                Source = new Uri("CustomShapes.xaml", UriKind.Relative)
            };
            var stencil = DiagramStencil.Create("MyShapes", "Custom Shapes", customShapesDictionary, shapeName => shapeName);

            DiagramToolboxRegistrator.RegisterStencil(stencil);
            diagramControl.SelectedStencils.Add("MyShapes");
        }
        public void RegisterShapes()
        {
            DiagramControl.ItemTypeRegistrator.Register(typeof(DiagramShapeEx));
            var stencil = new DiagramStencil("customShapes", "Custom Shapes");

            stencil.RegisterTool(new FactoryItemTool("activeTaskShape", () => "Active Task", diagram => new DiagramShapeEx {
                Content = "Active Task", Status = Status.Active
            }, new System.Windows.Size(150, 100), false));
            stencil.RegisterTool(new FactoryItemTool("inactiveTaskShape", () => "Inactive Task", diagram => new DiagramShapeEx {
                Content = "Inactive Task", Status = Status.Inactive
            }, new System.Windows.Size(150, 100), false));
            DiagramToolboxRegistrator.RegisterStencil(stencil);
            diagramControl1.OptionsBehavior.SelectedStencils = StencilCollection.Parse("customShapes");
        }
示例#7
0
 protected override void UnregisterCustomToolboxItems()
 {
     DiagramToolboxRegistrator.UnregisterStencil(DiagramToolboxRegistrator.GetStencil(OfficeStencilId));
 }