다음을 통해 공유


VisualState.Name 속성

정의

의 이름을 VisualState가져오거나 설정합니다.

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

속성 값

VisualState의 이름입니다.

예제

다음 예제에서는 호출된 형식의 개체를 Button 만들고 VisualStateGroup 상태, NormalPressedMouseOver상태에 대한 개체를 추가합니다VisualState.ControlTemplateCommonStates 이 예제에서는 Button 간결하게 생략하는 상태도 DisabledCommonStatesVisualStateGroup정의합니다. 전체 예제는 컨트롤에 대한 템플릿을 만드는 방법을 참조하세요.

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

설명

요소를 에 전달 NameVisualStateVisualStateManager하여 입력해야 하는 시각적 상태를 지정합니다.

Control VisualStateManager 컨트롤 작성자는 해당 클래스 시그니처를 ControlTemplate사용하여 TemplateVisualStateAttribute 컨트롤에서 ControlTemplate 찾을 것으로 예상되는 개체를 지정 VisualState 해야 합니다. ControlTemplate작성자는 새 VisualState 개체를 정의하고 속성을 속성에 지정된 값으로 TemplateVisualStateAttribute.Name 설정합니다Name.

WPF에 포함된 컨트롤에 대한 시각적 상태의 이름을 찾으려면 컨트롤 스타일 및 템플릿을 참조하세요. 기존 컨트롤에 대한 개체 및 VisualState 개체를 ControlTemplate 만드는 방법에 대한 자세한 내용은 컨트롤에 대한 템플릿을 만드는 방법을 참조하세요.

적용 대상