Setter.Property 속성

정의

Value가 적용되는 속성을 가져오거나 설정합니다.

public:
 property System::Windows::DependencyProperty ^ Property { System::Windows::DependencyProperty ^ get(); void set(System::Windows::DependencyProperty ^ value); };
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Modifiability=System.Windows.Modifiability.Unmodifiable, Readability=System.Windows.Readability.Unreadable)]
[System.Windows.Markup.Ambient]
public System.Windows.DependencyProperty Property { get; set; }
[<System.Windows.Localizability(System.Windows.LocalizationCategory.None, Modifiability=System.Windows.Modifiability.Unmodifiable, Readability=System.Windows.Readability.Unreadable)>]
[<System.Windows.Markup.Ambient>]
member this.Property : System.Windows.DependencyProperty with get, set
Public Property Property As DependencyProperty

속성 값

DependencyProperty

DependencyProperty가 적용되는 Value입니다. 기본값은 null입니다.

특성

예외

Property 속성은 null이 될 수 없습니다.

지정된 Property 속성이 읽기 전용인 경우

지정된 Value가 지정된 Property의 형식에 대해 유효하지 않은 경우

예제

다음 예제에서는 모든 TextBlock 요소에 적용할 스타일을 정의합니다.

<Style TargetType="{x:Type TextBlock}">
  <Setter Property="FontFamily" Value="Segoe Black" />
  <Setter Property="HorizontalAlignment" Value="Center" />
  <Setter Property="FontSize" Value="12pt" />
  <Setter Property="Foreground" Value="#777777" />
</Style>

다음 예제에서는 속성에 영향을 주는 스타일 선언을 Background 보여 주는 Control합니다. 이 예제의 속성 이름은 클래스(Control)StyleTargetType의 이름으로 한정됩니다.

<Style x:Key="Style1">
  <Setter Property="Control.Background" Value="Yellow"/>
</Style>

설명

예외 또는 예외에 Property 대한 Setter 속성과 Value 속성을 모두 지정해야 합니다.

적용 대상

추가 정보