This documentation is archived and is not being maintained.

BlockUIContainer.Child Property

Gets or sets the UIElement hosted by the BlockUIContainer.

Namespace: System.Windows.Documents
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

public UIElement Child { get; set; }
/** @property */
public UIElement get_Child ()

/** @property */
public void set_Child (UIElement value)

public function get Child () : UIElement

public function set Child (value : UIElement)

  <UIElement .../>

Property Value

The UIElement hosted by the BlockUIContainer.

An BlockUIContainer may directly host no more than one UIElement child. However, the child element hosted by an BlockUIContainer may host children of its own.

In XAML, wrapping a UIElement in an BlockUIContainer is equivalent to setting that UIElement as the value of the Child property.

The following example shows how to use the BlockUIContainer elements to host UIElement elements within flow content.

<FlowDocument ColumnWidth="400">
  <Section Background="GhostWhite">
      A UIElement element may be embedded directly in flow content
      by enclosing it in a BlockUIContainer element.
      <Button>Click me!</Button>
      The BlockUIContainer element may host no more than one top-level
      UIElement.  However, other UIElements may be nested within the
      UIElement contained by an BlockUIContainer element.  For example,
      a StackPanel can be used to host multiple UIElement elements within
      a BlockUIContainer element.
        <Label Foreground="Blue">Choose a value:</Label>
          <ComboBoxItem IsSelected="True">a</ComboBoxItem>
        <Label Foreground ="Red">Choose a value:</Label>
        <Label>Enter a value:</Label>
          A text editor embedded in flow content.

The following figure shows how this example renders.

Screenshot: UIElement embedded in flow content

The following example shows how to use the Child property programmatically.

Section secx = new Section();
Paragraph par1 = new Paragraph(new Run(" Text to precede the button... "));
Paragraph par2 = new Paragraph(new Run(" Text to follow the button... "));

// Create a new button to be hosted in the section.
Button buttonx = new Button();
buttonx.Content = "Click me!";

// Create a new BlockUIContainer, and assign the button 
// as the UI container's child.
BlockUIContainer uiCont = new BlockUIContainer();
uiCont.Child = buttonx;

// Add the text runs and UI container to the paragraph, in order.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0