How can I use the BlockUIContainer element to host UIElement objects within Flow content ?

Platform: WPF| Category : Flow Content, Printing

A BlockUIContainer is a flow content element that allows UIElement to be hosted inside the flow content. This can be done as follows.

[XAML]

<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>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.