Exemple #1
0
        public Flowchart()
        {
            // Initialize Ruler for SfDiagram
            HorizontalRuler = new Ruler {
                Orientation = Orientation.Horizontal
            };
            VerticalRuler = new Ruler {
                Orientation = Orientation.Vertical
            };

            //This command will get invoked when an item is added to the diagram.
            ItemAddedCommand = new Command(args => OnItemAdded((ItemAddedEventArgs)args));

            // Initialize Gridlines for SfDiagram
            SnapSettings = new SnapSettings()
            {
                SnapToObject    = SnapToObject.All,
                SnapConstraints = SnapConstraints.All,
            };

            //Initialize Context menu for diagram.
            Menu = null;

            // Initialize DataSourceSettings for SfDiagram
            DataSourceSettings = new FlowchartDataSourceSettings()
            {
                ParentId             = "ParentId",
                Id                   = "Id",
                DataSource           = GetData(),
                ConnectorTextMapping = "Label",
                ContentMapping       = "Name",
                ShapeMapping         = "_Shape",
                WidthMapping         = "_Width",
                HeightMapping        = "_Height"
            };

            // Initialize LayoutSettings for SfDiagram
            LayoutManager = new LayoutManager()
            {
                Layout = new FlowchartLayout()
                {
                    Orientation     = FlowchartOrientation.TopToBottom,
                    YesBranchValues = new List <string> {
                        "Yes", "True", "Y", "s"
                    },
                    YesBranchDirection = BranchDirection.LeftInFlow,
                    NoBranchValues     = new List <string> {
                        "No", "N", "False", "no"
                    },
                    NoBranchDirection = BranchDirection.RightInFlow,
                    HorizontalSpacing = 50,
                    VerticalSpacing   = 50,
                },
            };
        }
        public FlowChartViewModel(DemoControl demo)
        {
            View = demo;
            //This command will get invoked when an item is added to the diagram.
            ItemAddedCommand = new DelegateCommand(args => OnItemAdded((ItemAddedEventArgs)args));


            Constraints = Constraints.Remove(GraphConstraints.PageEditing, GraphConstraints.PanRails);

            //Initialize Context menu for diagram.
            Menu = null;

            // Initialize DataSourceSettings for SfDiagram
            DataSourceSettings = new FlowchartDataSourceSettings()
            {
                ParentId             = "ParentId",
                Id                   = "Id",
                DataSource           = GetData(),
                ConnectorTextMapping = "Label",
                ContentMapping       = "Name",
                ShapeMapping         = "_Shape",
                WidthMapping         = "_Width",
                HeightMapping        = "_Height"
            };

            // Initialize LayoutSettings for SfDiagram
            LayoutManager = new LayoutManager()
            {
                Layout = new FlowchartLayout()
                {
                    Orientation     = FlowchartOrientation.TopToBottom,
                    YesBranchValues = new List <string> {
                        "Yes", "True", "Y", "s"
                    },
                    YesBranchDirection = BranchDirection.LeftInFlow,
                    NoBranchValues     = new List <string> {
                        "No", "N", "False", "no"
                    },
                    NoBranchDirection = BranchDirection.RightInFlow,
                    HorizontalSpacing = 50,
                    VerticalSpacing   = 50,
                },
            };
        }