This is a migrated thread and some comments may be shown as answers.

Retain shape grouping after Layout

7 Answers 81 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Hans-Henrik
Top achievements
Rank 1
Hans-Henrik asked on 19 Mar 2015, 10:22 AM
Hi,

I have a diagram where i group some shapes together. At some point, I want the user to be able to do a Layout of what they have drawn, but I want grouped shapes to stay together how they are grouped.

The default Layout method rearranges shapes within a group, and in my case, that ens up being really messy. How can I implement a Layout method that honours the grouped shapes as one item?

/HH

7 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 19 Mar 2015, 12:07 PM
Hello Hans-Henrick,

You can try the following trick:
- place the different groups of shapes in DiagramContainerShapes
- perform the Layout
- on DiagramLayoutComplete event, remove the previously created containers.

Please let us know if this helps you move forward.


Regards,
Petar Mladenov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Hans-Henrik
Top achievements
Rank 1
answered on 19 Mar 2015, 12:50 PM
Any example code (C#) I can look at at any chance?
0
Hans-Henrik
Top achievements
Rank 1
answered on 20 Mar 2015, 09:05 AM
Hhm.. other options? This actually creates issues, as the project I have inherited, has a bunch of specialized (overrides) code, expecting certain types of shapes to be added.. unable to add a DiagramContainerShape right away.. to chenge all that would keep me busy for quite some time.

Could routing be a solution?
0
Petar Mladenov
Telerik team
answered on 20 Mar 2015, 09:52 AM
Hi Hans,

You can check the attached project in which the suggested approach is implemented in button click handler. In the captured video you can see how I group shapes 1-2-3 and then the layout keeps this configuration. What can be improved in this solution is a specific style for the container shape - so that the Layout will not take into account the hight of the container's Header - this way the group 1-2-3 will be vertically aligned with shapes 4 and 5.

Another solution could be to preserve some shapes' positions (relative or absolute) in a Dictionary, Layout and in DiagramLayoutComplete event - re-create the relative positions of the shapes from a particular group. However, this seems more complicated task and I would suggest using the ContainerShapes' approach - it gives a built-in groping which separates a group of shapes from the entire diagram Layout.

Regards,
Petar Mladenov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Petar Mladenov
Telerik team
answered on 07 May 2015, 08:20 AM
Hello Hans,

We want to suggest another solution you might consider. The TreeLayoutSettings and SugiyamaSettings classes provide IgnoreInvisible property. This means you can set some shapes collapsed, use this property set to True and on DiagramLayoutComplete return the collapsed shapes to Visible.

Regards,
Petar Mladenov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Hans-Henrik
Top achievements
Rank 1
answered on 18 May 2015, 09:27 AM
OK. I have not gotten to try this out yet. But, the functionality I am after, would be that I have a shape, and grouped with this shape, is a number of text objects. Now, I want to arrange the shapes, but I want the texts to keep with the shapes....
0
Petar Mladenov
Telerik team
answered on 20 May 2015, 07:31 AM
Hi Hans,

How are these text objects represented in RadDiagram ? Aren't they RadDiagramTextShapes ? If not, have you considered so ?


Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Diagram
Asked by
Hans-Henrik
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Hans-Henrik
Top achievements
Rank 1
Share this question
or