TextBlock 콘텐츠 모델 개요

업데이트: 2007년 11월

이 콘텐츠 모델 개요에서는 TextBlock에 대해 지원되는 콘텐츠를 설명합니다. TextBlock은 소량의 유동 콘텐츠를 표시하기 위한 가벼운 컨트롤입니다.

이 항목에는 다음 단원이 포함되어 있습니다.

  • TextBlock 콘텐츠 속성
  • 유동 콘텐츠 추가
  • 이 콘텐츠 모델을 공유하는 형식
  • TextBlock 개체를 포함할 수 있는 형식
  • 관련 항목

TextBlock 콘텐츠 속성

TextBlock의 콘텐츠 속성은 다음과 같습니다.

유동 콘텐츠 추가

TextBlockInline 유동 콘텐츠 요소를 호스팅하고 표시합니다. 지원되는 요소에는 AnchoredBlock, Bold, Hyperlink, InlineUIContainer, Italic, LineBreak, Run, SpanUnderline 등이 있습니다.

다음 예제에서는 Inlines 속성을 사용하여 흐름 요소를 TextBlock에 추가하는 방법을 보여 줍니다.

TextBlock textBlock1 = new TextBlock();
TextBlock textBlock2 = new TextBlock();

textBlock1.TextWrapping = textBlock2.TextWrapping = TextWrapping.Wrap;
textBlock2.Background = Brushes.AntiqueWhite;
textBlock2.TextAlignment = TextAlignment.Center;

textBlock1.Inlines.Add(new Bold(new Run("TextBlock")));
textBlock1.Inlines.Add(new Run(" is designed to be "));
textBlock1.Inlines.Add(new Italic(new Run("lightweight")));
textBlock1.Inlines.Add(new Run(", and is geared specifically at integrating "));
textBlock1.Inlines.Add(new Italic(new Run("small")));
textBlock1.Inlines.Add(new Run(" portions of flow content into a UI."));

textBlock2.Text =
    "By default, a TextBlock provides no UI beyond simply displaying its contents.";

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

스크린 샷: TextBlock 및 단추

이 콘텐츠 모델을 공유하는 형식

TextBlock만 이 콘텐츠 모델을 사용합니다.

TextBlock 개체를 포함할 수 있는 형식

WPF 콘텐츠 모델을 참조하십시오.

참고 항목

개념

유동 문서 개요