BlockUIContainer Class
TOC
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

BlockUIContainer Class

A block-level flow content element which enables UIElement elements (i.e. a Button) to be embedded (hosted) in flow content.

Namespace: System.Windows.Documents
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[ContentPropertyAttribute("Child")] 
public class BlockUIContainer : Block
/** @attribute ContentPropertyAttribute("Child") */ 
public class BlockUIContainer extends Block
ContentPropertyAttribute("Child") 
public class BlockUIContainer extends Block
<BlockUIContainer>
  Child
</BlockUIContainer>

A UIElement element (i.e. a Button) may be embedded directly in flow content by enclosing it in a BlockUIContainer (see example below).

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.

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

<FlowDocument ColumnWidth="400">
  <Section Background="GhostWhite">
    <Paragraph>
      A UIElement element may be embedded directly in flow content
      by enclosing it in a BlockUIContainer element.
    </Paragraph>
    <BlockUIContainer>
      <Button>Click me!</Button>
    </BlockUIContainer>
    <Paragraph>
      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.
    </Paragraph>
    <BlockUIContainer>
      <StackPanel>
        <Label Foreground="Blue">Choose a value:</Label>
        <ComboBox>
          <ComboBoxItem IsSelected="True">a</ComboBoxItem>
          <ComboBoxItem>b</ComboBoxItem>
          <ComboBoxItem>c</ComboBoxItem>
        </ComboBox>
        <Label Foreground ="Red">Choose a value:</Label>
        <StackPanel>
          <RadioButton>x</RadioButton>
          <RadioButton>y</RadioButton>
          <RadioButton>z</RadioButton>
        </StackPanel>
        <Label>Enter a value:</Label>
        <TextBox>
          A text editor embedded in flow content.
        </TextBox>
      </StackPanel>
    </BlockUIContainer>
  </Section>
</FlowDocument>

The following figure shows how this example renders.

Screenshot: UIElement embedded in flow content

System.Object
   System.Windows.Threading.DispatcherObject
     System.Windows.DependencyObject
       System.Windows.ContentElement
         System.Windows.FrameworkContentElement
           System.Windows.Documents.TextElement
             System.Windows.Documents.Block
              System.Windows.Documents.BlockUIContainer

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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
Show:
© 2016 Microsoft