Compartilhar via


Add an element to a layout panel

To add an element to a layout panel

  1. In your Microsoft Expression Blend project, under Objects and Timeline, double-click the layout panel to which you want to add an element. Notice that a yellow highlight appears around the panel to indicate that it is now the active element.

  2. Do one of the following:

    • In the Toolbox, click one of the drawing tools (for example, Ellipse Cc295304.8938cfdf-9b75-4a33-bc88-b0636e114a0d(en-us,Expression.10).png or Pen Cc295304.894f8612-e0ed-4e00-84cf-a9bc8f38fc54(en-us,Expression.10).png), and then draw an element into the active panel.

    • In the Asset Library Cc295304.0224cabd-5da1-4e01-bddd-4a647401a098(en-us,Expression.10).png, select an element (or control)—for example, select TextBlock Cc295304.42165963-00f7-4a33-abcd-b0849edebada(en-us,Expression.10).png—and then draw the element into the active panel.

    Tip

    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 Asset Library. 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.

Note

When you add a child element to specific layout panels or layout elements you may need to observe the following:

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

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

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