InlineUIContainer.Child 속성

정의

UIElement에 의해 호스팅되는 InlineUIContainer를 가져오거나 설정합니다.

public:
 property System::Windows::UIElement ^ Child { System::Windows::UIElement ^ get(); void set(System::Windows::UIElement ^ value); };
public System.Windows.UIElement Child { get; set; }
member this.Child : System.Windows.UIElement with get, set
Public Property Child As UIElement

속성 값

UIElement

UIElement에 의해 호스팅되는 InlineUIContainer입니다.

예제

다음 예제에서는 사용 하는 방법을 보여 줍니다 합니다 InlineUIContainer 요소를 호스트 UIElement 유동 콘텐츠 내에서 요소입니다.

<FlowDocument ColumnWidth="400">
  <Paragraph Background="GhostWhite">
    <Run>
      A UIElement element may be embedded directly in flow content
      by enclosing it in an InlineUIContainer element.
    </Run>
    <LineBreak/>
    <LineBreak/>
    <InlineUIContainer>
      <Button>Click me!</Button>
    </InlineUIContainer>
    <LineBreak/>
    <LineBreak/>
    <Run>
      The InlineUIContainer element may host no more than one top-level
      UIElement.  However, other UIElements may be nested within the
      UIElement contained by an InlineUIContainer element.  For example,
      a StackPanel can be used to host multiple UIElement elements within
      an InlineUIContainer element.
    </Run>
    <InlineUIContainer>
      <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>
    </InlineUIContainer>
  </Paragraph>
</FlowDocument>

다음 그림은 이 예제에서 렌더링하는 방법을 보여줍니다.

스크린 샷: 흐름에 포함된 UIElement 요소

다음 예제에서는 사용 하는 방법의 Child 속성 프로그래밍 방식으로 합니다.

Paragraph parx = new Paragraph();
Run run1 = new Run(" Text to precede the button... ");
Run run2 = new Run(" Text to follow the button... ");

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

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

// Add the text runs and UI container to the paragraph, in order.
parx.Inlines.Add(run1);
parx.Inlines.Add(uiCont);
parx.Inlines.Add(run2);
Dim parx As New Paragraph()
Dim run1 As New Run(" Text to precede the button... ")
Dim run2 As New Run(" Text to follow the button... ")

' Create a new button to be hosted in the paragraph.
Dim buttonx As New Button()
buttonx.Content = "Click me!"

' Create a new InlineUIContainer, and assign the button 
' as the UI container's child.
Dim uiCont As New InlineUIContainer()
uiCont.Child = buttonx

' Add the text runs and UI container to the paragraph, in order.
parx.Inlines.Add(run1)
parx.Inlines.Add(uiCont)
parx.Inlines.Add(run2)

설명

InlineUIContainer 개 이상에 직접 호스팅할 수 있습니다 UIElement 자식입니다. 그러나 자식 요소를 호스팅하는 InlineUIContainer 자체의 자식을 호스팅할 수 있습니다.

XAML에서 래핑은 UIElement InlineUIContainer 속성 값 Child 으로 설정하는 UIElement 것과 같습니다.

적용 대상