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 VisualStateGroupControlTemplate oluşturur ve durumları, Button, CommonStatesve VisualStateiçin nesneler eklerNormal.PressedMouseOver , Button içinde DisabledCommonStatesadlı VisualStateGroup 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 VisualState içinde hangi ControlTemplate nesneleri bulmayı TemplateVisualStateAttribute beklediğini belirtmelidir. ControlTemplateyazarları yeni VisualState nesneler tanımlar ve özelliğini özelliği tarafından belirtilen değere Name ayarlarTemplateVisualStateAttribute.Name.

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 ControlTemplate nesneleri oluşturma VisualState hakkında bilgi için bkz. Denetim için şablon oluşturma.

Şunlara uygulanır