Setter.Property Özellik

Tanım

uygulanacağı özelliği Value alır veya ayarlar.

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

Özellik Değeri

DependencyProperty

DependencyProperty Value uygulanacağı A. Varsayılan değer boştur.

Öznitelikler

Özel durumlar

Property özelliği olamaznull.

Belirtilen Property özellik salt okunur olamaz.

Belirtilen, belirtilen Value türü Propertyiçin geçerli değilse.

Örnekler

Aşağıdaki örnek, her TextBlock öğeye uygulanacak bir stili tanımlar.

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

Aşağıdaki örnekte, özelliğini etkileyecek Background bir stil bildirimi gösterilmektedir Control. bu örnekteki özellik adının sınıfıControl () adıyla nitelendiğini unutmayın çünkü Style belirtilmez TargetType.

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

Açıklamalar

bir veya özel durum oluşturulurken Setter hem ve Value Property özelliklerini belirtmeniz gerektiğini unutmayın.

Şunlara uygulanır

Ayrıca bkz.