예제 #1
0
        private void OnNodeChangedCommand(object obj)
        {
            var          args = obj as ChangeEventArgs <object, NodeChangedEventArgs>;
            CustomNodeVM node = args.Item as CustomNodeVM;

            if (node != null && node.ParentLane != null && args.NewValue.InteractionState == NodeChangedInteractionState.Dragging)
            {
                LaneViewModel parentlane = (args.Item as CustomNodeVM).ParentLane as LaneViewModel;
                args.BoundaryConstraints = (parentlane.Info as ILaneInfo).Bounds;
            }
        }
예제 #2
0
        private void InitializeDiagram()
        {
            //Initialize SwimlaneCollection to SfDiagram
            this.Swimlanes = new SwimlaneCollection();

            //Creating the SwimlaneViewModel
            SwimlaneViewModel swimlane = new SwimlaneViewModel()
            {
                UnitWidth   = 450,
                UnitHeight  = 420,
                OffsetX     = 400,
                OffsetY     = 450,
                Orientation = Orientation.Horizontal,
            };
            LaneViewModel lane1 = new LaneViewModel()
            {
                UnitHeight = 100,
            };

            swimlane.Lanes = new LaneCollection()
            {
                lane1
            };

            CustomNodeVM node = new CustomNodeVM()
            {
                UnitHeight = 50, UnitWidth = 50, LaneOffsetX = 100, LaneOffsetY = 30
            };

            CustomNodeVM node1 = new CustomNodeVM()
            {
                UnitHeight = 50, UnitWidth = 50, LaneOffsetX = 250, LaneOffsetY = 30
            };

            (this.Nodes as NodeCollection).Add(node);
            (this.Nodes as NodeCollection).Add(node1);

            (lane1.Children as LaneChildren).Add(node);
            (lane1.Children as LaneChildren).Add(node1);

            //Add Swimlane to Swimlanes property of the Diagram
            (this.Swimlanes as SwimlaneCollection).Add(swimlane);
        }