Aracılığıyla paylaş


VisualState.Name Özellik

Tanım

öğesinin adını VisualStatealır veya ayarlar.

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
public string Name { get; set; }
member this.Name : string with get, set
Public Property Name As String

Özellik Değeri

öğesinin VisualStateadı.

Örnekler

Aşağıdaki örnek, adlı öğesinin içinde bir VisualStateGroupButton oluşturur ve durumları, Normal, Pressedve MouseOveriçin nesneler eklerVisualState.ControlTemplateCommonStates , Button içinde CommonStatesVisualStateGroupadlı Disabled bir durum da tanımlar, ancak örnekte kısa olması için bu durum atlanır. Tüm örnek için bkz. Denetim için şablon oluşturma.

  <!--Define the states and transitions for the common states.
      The states in the VisualStateGroup are mutually exclusive to
      each other.-->
  <VisualStateGroup x:Name="CommonStates">

    <!--The Normal state is the state the button is in
        when it is not in another state from this VisualStateGroup.-->
    <VisualState x:Name="Normal" />

    <!--Change the SolidColorBrush, BorderBrush, to red when the
        mouse is over the button.-->
    <VisualState x:Name="MouseOver">
      <Storyboard>
        <ColorAnimation Storyboard.TargetName="BorderBrush" 
                        Storyboard.TargetProperty="Color" 
                        To="Red" />
      </Storyboard>
    </VisualState>

    <!--Change the SolidColorBrush, BorderBrush, to Transparent when the
        button is pressed.-->
    <VisualState x:Name="Pressed">
      <Storyboard>
        <ColorAnimation Storyboard.TargetName="BorderBrush" 
                        Storyboard.TargetProperty="Color"
                        To="Transparent"/>
      </Storyboard>
    </VisualState>

    <!--The Disabled state is omitted for brevity.-->
  </VisualStateGroup>
</VisualStateManager.VisualStateGroups>

Açıklamalar

Öğesinin öğesini öğesine geçirerek NameVisualStateVisualStateManagerhangi görsel durumunun girileceğini belirtirsiniz.

bir Control içinde öğesini VisualStateManager kullandığındaControlTemplate, denetim yazarı, öğesini sınıf imzasına koyarak denetimin TemplateVisualStateAttribute içinde hangi VisualState nesneleri bulmayı ControlTemplate beklediğini belirtmelidir. ControlTemplateyazarları yeni VisualState nesneler tanımlar ve özelliğini özelliği tarafından belirtilen değere TemplateVisualStateAttribute.Name ayarlarName.

WPF ile birlikte gelen denetimlerin görsel durumlarının adlarını bulmak için bkz. Denetim Stilleri ve Şablonları. Var olan denetimler için ve VisualState nesneleri oluşturma ControlTemplate hakkında bilgi için bkz. Denetim için şablon oluşturma.

Şunlara uygulanır