This question is locked. New answers and comments are not allowed.
Hello,
I need to implement Group, Align, BringToFront and such functions for my project. Unfortunately, my diagram and ribbon views are in seperate Regions (We use MVVM with prism). So I need to implement a code block to provide these functionality.
I found a code piece in these forum to replace the BringToFront function but It didn't run good.
public void Arrange(string param){ if (!this.Diagram.SelectedItems.IsNullOrEmpty()) { IEnumerable<IDiagramItem> items = this.Diagram.SelectedItems.Select(i => this.Diagram.ContainerGenerator.ContainerFromItem(i)); if (param == "Top") { this.Diagram.BringToFront(items, true); } else if (param == "Forward") { this.Diagram.BringForward(items, true); } else if (param == "Back") { this.Diagram.SendToBack(items, true); } else if (param == "Backward") { this.Diagram.SendBackward(items, true); } }}I also implement some other codes to provide Group and Align function accordingly. Can you suggest a new way.
public void Group(){
if (!this.Diagram.SelectedItems.IsNullOrEmpty()) { var items = new List<IGroupable>(); foreach (var item in this.Diagram.SelectedItems) { items.Add(item as IGroupable); } this.Diagram.Group(string.Empty, true, items.ToArray()); }}
public void Align(Alignment alignment){ if (!this.Diagram.SelectedItems.IsNullOrEmpty()) { var items = new List<IShape>(); foreach (var item in this.Diagram.SelectedItems.Where(x => x is IShape)) { items.Add(item as IShape); } this.Diagram.Align(alignment, items); }}