Пример #1
0
        public ScrollingViewModel()
        {
            ScrollSettings = new ScrollSettings();

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.ShowLines,
            };

            PageSettings = new PageSettings()
            {
                PageHeight     = 723,
                PageWidth      = 1124,
                ShowPageBreaks = true,
                MultiplePage   = true,
            };

            SelectedItems = new SelectorViewModel();

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };
            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            SelectorChangedCommand = new DelegateCommand(OnSelectorChanged);
        }
Пример #2
0
        public DiagramVM()
        {
            PageSettings = new PageSettings()
            {
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
                PageBackground  = new SolidColorBrush(Colors.White)
            };
            ScrollSettings = new ScrollSettings()
            {
                ScrollLimit = ScrollLimit.Diagram
            };
            Menu = null;
            DataSourceSettings = new DataSourceSettings()
            {
                ParentId   = "ParentId",
                Id         = "EmpId",
                DataSource = GetData()
            };
            LayoutManager = new Syncfusion.UI.Xaml.Diagram.Layout.LayoutManager()
            {
                Layout = new DirectedTreeLayout()
                {
                    Type        = LayoutType.Hierarchical,
                    Orientation = TreeOrientation.LeftToRight,
                }
            };

            ItemDeletingCommand = new Command(OnItemDeleting);
        }
Пример #3
0
        public VisualStyles()
        {
            Nodes = new ObservableCollection <NodeVM>();

            //Collection Changed event to update the Node
            (Nodes as ObservableCollection <NodeVM>).CollectionChanged += (s, e) =>
            {
                if (e.NewItems != null)
                {
                    (e.NewItems[0] as NodeVM).Update();
                }
            };

            //Create Nodes
            CreateNodes();

            //Undoable Constraints used to enable/disable Undo/Redo the Action.
            Constraints = Constraints.Add(GraphConstraints.Undoable);

            //SnapConstraints used to control the Vsibility of Gridlines and enable/disable the Snapping.
            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            DefaultConnectorType = ConnectorType.Orthogonal;
            ScrollSettings       = new ScrollSettings()
            {
                ScrollLimit = ScrollLimit.Diagram,
            };

            KnownTypes = GetKnownTypes;

            //PageSettings used to enable the Appearance of Diagram Page.
            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
                PageWidth       = 793.5,
                PageHeight      = 1122.5,
                ShowPageBreaks  = true,
            };

            //Ruler used to Creating Scale models.
            HorizontalRuler = new Ruler();
            VerticalRuler   = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            ItemAddedCommand = new Command(OnItemAddedCommand);
        }
Пример #4
0
        public RadialTree()
        {
            //Initialize Diagram Properties

            Constraints = Constraints.Remove(GraphConstraints.PageEditing);
            Constraints = Constraints.Add(GraphConstraints.Pannable, GraphConstraints.Zoomable);

            ScrollSettings = new ScrollSettings()
            {
                ScrollLimit = ScrollLimit.Diagram,
            };

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.White),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };


            // Initialize Layout Data

            Employees employee = new Employees();

            GetData(employee);

            DataSourceSettings = new DataSourceSettings()
            {
                ParentId   = "ParentId",
                Id         = "EmpId",
                DataSource = employee,
                Root       = "1",
            };

            LayoutManager = new LayoutManager()
            {
                Layout = new RadialTreeLayout()
                {
                    HorizontalSpacing = 10,
                    VerticalSpacing   = 30
                }
            };
        }
Пример #5
0
        public PortsDiagramViewModel()
        {
            #region DiagramViewModel Properties , Commands Initialization

            ItemUnSelectedCommand = new Command(OnItemUnselectedCommand);

            ItemSelectedCommand = new Command(OnItemSelectedCommand);

            Theme = new SimpleTheme();

            DefaultConnectorType = ConnectorType.Orthogonal;

            ScrollSettings = new ScrollSettings()
            {
                ScrollLimit = ScrollLimit.Diagram,
            };

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            HorizontalRuler = new Ruler();

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical,
            };

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands | SelectorConstraints.HideDisabledResizer,
            };

            #endregion

            #region Node Creation

            NodeViewModel Node1 = CreateNode(65, 100, 200, 150, "Rectangle", "Publisher", true);
            NodeViewModel Node2 = CreateNode(65, 100, 450, 150, "Rectangle", "Completed Book", false);
            NodeViewModel Node3 = CreateNode(65, 100, 700, 150, "Rectangle", "Board", false);
            NodeViewModel Node4 = CreateNode(65, 100, 450, 300, "Decision", "1st Review", false);
            NodeViewModel Node5 = CreateNode(65, 100, 700, 300, "Decision", "Approval", false);
            NodeViewModel Node6 = CreateNode(65, 100, 450, 450, "Rectangle", "Legal Terms", false);
            NodeViewModel Node7 = CreateNode(65, 100, 450, 600, "Decision", "2nd Review", false);

            #endregion

            #region Port Creation

            CreateNodePort(Node1, "NodePort11", 0, 0.5, "In");
            CreateNodePort(Node1, "NodePort12", 1, 0.5, "Out");
            CreateNodePort(Node1, "NodePort13", 0.25, 1, "In");
            CreateNodePort(Node1, "NodePort14", 0.5, 1, "Out");
            CreateNodePort(Node1, "NodePort15", 0.75, 1, "In");

            CreateNodePort(Node2, "NodePort21", 0, 0.5, "In");
            CreateNodePort(Node2, "NodePort22", 0.5, 1, "Out");
            CreateNodePort(Node2, "NodePort23", 1, 0.4, "Out");
            CreateNodePort(Node2, "NodePort24", 1, 0.6, "In");

            CreateNodePort(Node3, "NodePort31", 0, 0.4, "In");
            CreateNodePort(Node3, "NodePort32", 0.5, 1, "Out");

            CreateNodePort(Node4, "NodePort41", 0, 0.5, "Out");
            CreateNodePort(Node4, "NodePort42", 0.5, 0, "In");
            CreateNodePort(Node4, "NodePort43", 0.5, 1, "Out");

            CreateNodePort(Node5, "NodePort51", 0.5, 0, "In");
            CreateNodePort(Node5, "NodePort52", 0.5, 1, "Out");

            CreateNodePort(Node6, "NodePort61", 0, 0.5, "In");
            CreateNodePort(Node6, "NodePort62", 0.5, 0, "In");
            CreateNodePort(Node6, "NodePort63", 0.5, 1, "Out");

            CreateNodePort(Node7, "NodePort71", 0, 0.5, "Out");
            CreateNodePort(Node7, "NodePort72", 0.5, 0, "In");
            CreateNodePort(Node7, "NodePort73", 1, 0.5, "Out");

            #endregion

            #region NodeCollection

            (Nodes as NodeCollection).Add(Node1);
            (Nodes as NodeCollection).Add(Node2);
            (Nodes as NodeCollection).Add(Node3);
            (Nodes as NodeCollection).Add(Node4);
            (Nodes as NodeCollection).Add(Node5);
            (Nodes as NodeCollection).Add(Node6);
            (Nodes as NodeCollection).Add(Node7);

            #endregion
        }
Пример #6
0
        public DiagramVM()
        {
            #region DiagramViewModel Properties , Commands Initialization

            ItemUnSelectedCommand = new Command(OnItemUnselectedCommand);

            ItemSelectedCommand = new Command(OnItemSelectedCommand);

            Theme = new SimpleTheme();

            DefaultConnectorType = ConnectorType.Orthogonal;

            ScrollSettings = new ScrollSettings()
            {
                ScrollLimit = ScrollLimit.Diagram,
            };

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All,
            };

            HorizontalRuler = new Ruler();

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical,
            };

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.QuickCommands | SelectorConstraints.HideDisabledResizer,
            };

            #endregion

            #region Node Creation

            NodeViewModel Node1 = CreateNode(65, 100, 200, 150, "Rectangle", "Publisher", true);
            NodeViewModel Node2 = CreateNode(65, 100, 450, 150, "Rectangle", "Completed Book", false);


            #endregion

            #region Port Creation

            CreateNodePort(Node1, "NodePort11", 0.5, 0, "In");
            CreateNodePort(Node1, "NodePort12", 0.5, 1, "Out");

            CreateNodePort(Node2, "NodePort21", 0.5, 0, "In");
            CreateNodePort(Node2, "NodePort22", 0.5, 1, "Out");

            #endregion

            #region NodeCollection

            (Nodes as NodeCollection).Add(Node1);
            (Nodes as NodeCollection).Add(Node2);


            #endregion
        }