Gavin S
Gavin S

Reputation: 588

How to change the z-order of classes in the Visual Studio Class Designer?

Maybe I am misunderstanding what the Class Designer in Visual Studio was intended for, but I am really struggling with expanded classes being displayed behind other classes on the canvas.

I would like to have two collapsed classes, one above the other. Then when I expand the class above it should display above the class below, so that the class below does not obstruct the members of the class above.

I realise that adding my classes in the right order will do this, but I don't want to re-add all controls when I want to change layout. Where is the "Send to Back / Send to Front" button??

Upvotes: 4

Views: 674

Answers (2)

Tobias Reich
Tobias Reich

Reputation: 5160

Not sure this is still an issue but I just had a similar problem when visualizing things in "UML-like" structures in VS 2013. I found that a more or less simple way might be to change the order in the .layout file:

Click the .layout link

The example hopefully shows how to do:

First example - Action is "under" the Object:

 <actionShape Id="..." absoluteBounds="..." customColor="...">
      <opaqueActionMoniker Id="..." LastKnownName="Action1" />
    </actionShape>
    <objectNodeShape Id="..." absoluteBounds="..." customColor="White">
      <objectNodeMoniker Id="..." LastKnownName="Object" />
    </objectNodeShape>

Second Example: I changed the order. The Action is above the Object:

 <objectNodeShape Id="..." absoluteBounds="..." customColor="White">
      <objectNodeMoniker Id="..." LastKnownName="Object" />
    </objectNodeShape>
    <actionShape Id="..." absoluteBounds="..." customColor="...">
      <opaqueActionMoniker Id="..." LastKnownName="Action1" />
    </actionShape>   

Z-Order is changed

I know, this is probably not the best way to do but it's the best I found. Hopefully it helps to anyone.

Upvotes: 2

user1385230
user1385230

Reputation:

Sorry for digging up an old post, but from the looks of it there aren't any such buttons, nor have they been added in Visual Studio 2012. Based on what I found in the MSDN forums here, this has been brought up before. I'm not sure if either of the posters in that thread actually went on to add the suggestion in Microsoft Connect, since it seems to be all VS 2012 now, but I've added a request for it here. Hopefully they get around to it eventually.

Upvotes: 1

Related Questions