Add an object to a layout panel

To add an object to a layout panel

  1. In your Blend for Visual Studio 2012 project, in the Objects and Timeline panel, click the layout panel to which you want to add an object. Notice that a blue highlight appears around the panel to indicate that it is now the active object.

  2. Do one of the following:

    • In the Tools panel, click one of the drawing tools (for example, Ellipse 8938cfdf-9b75-4a33-bc88-b0636e114a0d or Pen 894f8612-e0ed-4e00-84cf-a9bc8f38fc54), and then draw an object in the active panel.

    • In the Assets panel, select an object (or control)—for example, select TextBlock 42165963-00f7-4a33-abcd-b0849edebada—and then draw the object in the active panel.


    If you want a control to use its default size (generally, an optimal size to begin working with), double-click the control when you select it from the Assets panel. The control will be added to the top-left area of the active panel. You can then drag the control to position and otherwise modify it as you want.

When you add a child object to specific layout panels or layout containers, you may need to observe the following:

  • DockPanel When you add child objects to a dock panel, the objects are docked to the left part of the panel by default. The last child object that you add can fill the remaining space in the panel if the LastChildFill property for that object is set to True. By default, this property is set to False. When objects fill up the panel, they are then clipped or hidden by the parent layout container.

  • StackPanel In a stack panel, any object that you create or draw will automatically be added to the stack as the last child. As you add more child objects, note that the stack panel will clip (or hide) those objects that do not fit. To edit clipped child objects, select them by clicking on them in the Objects and Timeline panel. You can then edit the bounding box for the objects, and so on.

  • Popup, Viewbox, ScrollViewer, Border Popup, Viewbox, ScrollViewer, and Border take only a single child object. Be aware that when you add child objects to these layout containers, each child object that you add will simply replace the previous child object. In general, place a grid or canvas panel in these layout containers so that they can hold multiple child objects.