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

속성 값

String

VisualState의 이름입니다.

예제

다음 예제에서는 VisualStateGroupControlTemplateButton 호출 CommonStates 추가 VisualState 개체의 상태에 대 한 Normal, Pressed, 및 MouseOver합니다. 이 예제에서는 Button 간결하게 생략하는 상태도 Disabled CommonStates VisualStateGroup정의합니다. 전체 예제를 보려면 ControlTemplate을 만들어 기존 컨트롤의 모양 사용자 지정합니다.

  <!--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 사용 하 여는 VisualStateManagerControlTemplate, 컨트롤 작성자는 지정 해야 VisualState 개체에서 찾을 수 있어야 합니다 해당 ControlTemplate 배치 하 여는 TemplateVisualStateAttribute 클래스 시그니처에 대. ControlTemplate 작성자는 새 정의 VisualState 집합과 개체를 Name 속성에 지정 된 값을는 TemplateVisualStateAttribute.Name 속성입니다.

WPF에 포함된 컨트롤의 시각적 상태 이름을 찾으려면 컨트롤 스타일 및 템플릿을 참조하세요. 만드는 방법에 대 한 자세한를 ControlTemplate 하 고 VisualState 기존 컨트롤에 대 한 개체 참조 ControlTemplate을 만들어 기존 컨트롤의 모양 사용자 지정합니다.

적용 대상