TextElement.Foreground 속성

정의

요소의 내용에 적용할 브러시를 가져오거나 설정합니다.

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

속성 값

Brush

텍스트 콘텐츠에 적용하는 데 사용되는 브러시입니다. 기본값은 Black입니다.

예제

다음 예제에서는 설정 하는 방법을 보여 줍니다 합니다 Foreground 특성을 사용 하 여 Paragraph 를 예제 요소로 합니다.

<FlowDocumentReader>
  <FlowDocument>
    <Paragraph
      Background="Bisque"
      Foreground="DarkGreen"
      Padding="4"
    >
      <Run>
        This text has a foreground color of dark green, and a background color of bisque.
      </Run>
    </Paragraph>
  </FlowDocument>
</FlowDocumentReader>

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

스크린샷: 녹색 전경, 황갈색 배경

다음 예제에서는 설정 하는 방법의 Foreground 속성 프로그래밍 방식으로 합니다.

Run run = new Run(
    "This text has a foreground color of dark green, and a background color of bisque.");
Paragraph par = new Paragraph(run);

par.Background = Brushes.Bisque;
par.Foreground = Brushes.DarkGreen;
Dim run As New Run("This text has a foreground color of dark green, and a background color of bisque.")
Dim par As New Paragraph(run)

par.Background = Brushes.Bisque
par.Foreground = Brushes.DarkGreen

설명

사용할 수 있는 미리 정의 된 브러시 색을 보여 주는 견본 테이블을 참조 하세요. Brushes합니다.

이 종속성 속성에는 사용 된 연결 된 속성에도 합니다. XAML에서 사용량은 <object TextElement.Foreground="value".../>개체 가 개체 요소(일반적으로 흐름 요소)TextElement이며 은 구현 값으로 Brush 확인되는 문자열입니다. 코드에서 연결 된 속성에서 지원 되는 GetForegroundSetForeground 메서드. 연결 된 속성 아니므로 일반적인 수 있는 대부분의 요소에는 TextElement 연결 되지 않은 이와 유사한 지원 Foreground 속성을.

종속성 속성 정보

식별자 필드 ForegroundProperty
메타 데이터 속성 설정 true AffectsRender, Inherits, SubPropertiesDoNotAffectRender

적용 대상

추가 정보