Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Using the Diagram Commands from code

$
0
0

Hello, 

I also needed this feature thanks. but I still need something like that for both Align and Group function. Below solutions fails on runtime.  

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);
    }
}

Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>