private void Diagram_Loaded(object sender) { diagram.EnableDrag = false; diagram.ShowSelectorHandle(false, SelectorPosition.SourcePoint); diagram.ShowSelectorHandle(false, SelectorPosition.TargetPoint); diagram.ShowSelectorHandle(false, SelectorPosition.Rotator); diagram.ShowSelectorHandle(false, SelectorPosition.TopLeft); diagram.ShowSelectorHandle(false, SelectorPosition.TopRight); diagram.ShowSelectorHandle(false, SelectorPosition.MiddleLeft); diagram.ShowSelectorHandle(false, SelectorPosition.MiddleRight); diagram.ShowSelectorHandle(false, SelectorPosition.BottomCenter); diagram.ShowSelectorHandle(false, SelectorPosition.BottomLeft); diagram.ShowSelectorHandle(false, SelectorPosition.BottomRight); diagram.ShowSelectorHandle(false, SelectorPosition.TopCenter); diagram.LayoutManager = new LayoutManager() { Layout = new MindMapLayout() { MindMapOrientation = Syncfusion.SfDiagram.iOS.Orientation.Horizontal, HorizontalSpacing = 70, } }; diagram.LayoutManager.Layout.UpdateLayout(); diagram.Select(RootNode); diagram.BringToView(RootNode); }
private void Diagram_UserHandleClicked(object sender, UserHandleClickedEventArgs args) { SelectedNode = diagram.SelectedItems[0] as Node; if (args.Item.Name == "Delete") { diagram.RemoveNode(SelectedNode, true); (diagram.LayoutManager.Layout as MindMapLayout).UpdateLayout(); } else if (args.Item.Name == "ExpColl") { if (SelectedNode.IsExpanded) { SelectedNode.IsExpanded = false; args.Item.Content = GetHandleImage("mindmapcollpase.png"); diagram.UserHandles[0].Visible = false; if (SelectedNode == RootNode) { diagram.UserHandles[1].Visible = false; } } else { SelectedNode.IsExpanded = true; args.Item.Content = GetHandleImage("mindmapexpand.png"); diagram.UserHandles[0].Visible = true; if (SelectedNode == RootNode) { diagram.UserHandles[1].Visible = true; } } (diagram.LayoutManager.Layout as MindMapLayout).UpdateLayout(); diagram.Select(SelectedNode); } else if (args.Item.Name == "info") { AddInfo(); } else { if (args.Item.Name == "Left") { CurrentHandle = UserHandlePosition.Left; ShowInfo(); } else if (args.Item.Name == "Right") { CurrentHandle = UserHandlePosition.Right; ShowInfo(); } } }
internal void ShowPopUp(string positive, string negative) { alertBuilder.SetTitle("Enter Text"); editText.Text = _inputstring; editText.FocusableInTouchMode = true; editText.RequestFocus(); editText.SetBackgroundColor(Color.WhiteSmoke); editText.SetTextColor(Color.Black); alertBuilder.SetView(editText); alertBuilder.SetCancelable(false); alertBuilder.SetPositiveButton(positive, (senderAlert, args) => { diagram.Alpha = 1; diagram.PageSettings.BackgroundColor = Color.White; if (editText.Text == null) { editText.Text = ""; } var node = new Node(diagram.Context); if (CurrentHandle == UserHandlePosition.Left) { node.OffsetX = SelectedNode.OffsetX - SelectedNode.Width - 100; node.OffsetY = SelectedNode.OffsetY; } else if (CurrentHandle == UserHandlePosition.Right) { node.OffsetX = SelectedNode.OffsetX + SelectedNode.Width + 100; node.OffsetY = SelectedNode.OffsetY; } node.Width = SelectedNode.Width; node.Height = SelectedNode.Height; node.ShapeType = ShapeType.RoundedRectangle; node.Style.StrokeWidth = 3; if (SelectedNode == RootNode) { index = rnd.Next(5); node.Style.Brush = new SolidBrush(FColor[index]); node.Style.StrokeBrush = new SolidBrush(SColor[index]); } else { node.Style = SelectedNode.Style; } node.Annotations.Add(new Annotation() { Content = editText.Text, FontSize = 14 * MainActivity.Factor, TextBrush = new SolidBrush(Color.Black) }); diagram.AddNode(node); var c1 = new Connector(diagram.Context); c1.SourceNode = SelectedNode; c1.TargetNode = node; //c1.Style.StrokeBrush = node.Style.StrokeBrush; //c1.Style.StrokeWidth = 3; //c1.TargetDecoratorStyle.Fill = (node.Style.StrokeBrush as SolidBrush).FillColor; //c1.TargetDecoratorStyle.StrokeColor = (c1.TargetNode.Style.StrokeBrush as SolidBrush).FillColor; //c1.SegmentType = SegmentType.CurveSegment; //c1.Style.StrokeStyle = StrokeStyle.Dashed; diagram.AddConnector(c1); if (CurrentHandle == UserHandlePosition.Left) { if (!(diagram.LayoutManager.Layout as MindMapLayout).EnableFreeForm) { (diagram.LayoutManager.Layout as MindMapLayout).UpdateLeftOrTop(); } } else if (CurrentHandle == UserHandlePosition.Right) { if (!(diagram.LayoutManager.Layout as MindMapLayout).EnableFreeForm) { (diagram.LayoutManager.Layout as MindMapLayout).UpdateRightOrBottom(); } } m_mindmap.SelectedNode = node; m_mindmap.UpdateHandle(); diagram.Select(node); diagram.BringToView(node); m_mindmap.UpdateTheme(); }); alertBuilder.SetNegativeButton(negative, (senderAlert, args) => { alertBuilder.SetCancelable(true); }); alertBuilder.Show(); }