VisualState 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨트롤이 특정 상태일 때의 시각적 모양을 나타냅니다.
public ref class VisualState : System::Windows::DependencyObject
[System.Windows.Markup.ContentProperty("Storyboard")]
[System.Windows.Markup.RuntimeNameProperty("Name")]
public class VisualState : System.Windows.DependencyObject
[<System.Windows.Markup.ContentProperty("Storyboard")>]
[<System.Windows.Markup.RuntimeNameProperty("Name")>]
type VisualState = class
inherit DependencyObject
Public Class VisualState
Inherits DependencyObject
- 상속
- 특성
예제
다음 예제에서는 호출된 형식의 개체를 Button 만들고 VisualStateGroup 상태, NormalPressed및 MouseOver상태에 대한 개체를 추가합니다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>
설명
A VisualState 는 컨트롤이 특정 상태일 때의 모양을 지정합니다. 예를 들어 눌렀을 Button 때 테두리는 일반과 다른 색일 수 있습니다. 클래스에는 VisualStateStoryboard 컨트롤의 모양을 변경하는 속성이 있습니다. 컨트롤이 속성에 지정된 VisualState.Name 상태로 들어가면 Storyboard 시작됩니다. 컨트롤이 상태를 종료하면 중지됩니다 Storyboard .
속성에 VisualStateGroup.States 개체가 포함됩니다 VisualState . VisualStateGroup 개체는 연결된 속성에 VisualStateManager.VisualStateGroups 추가되며, 이 속성은 에 정의되어 있습니다 FrameworkElement. 개체를 추가할 FrameworkElement수 VisualState 있지만 일반적으로는 다음 중Control에서 ControlTemplate 사용됩니다. 기존 컨트롤에 대한 개체 및 VisualState 개체를 ControlTemplate 만드는 방법에 대한 자세한 내용은 컨트롤에 대한 템플릿을 만드는 방법을 참조하세요. 외부의 개체를 사용하는 VisualState 예제는 클래스를 ControlTemplate참조하세요 VisualStateManager .
생성자
| Name | Description |
|---|---|
| VisualState() |
VisualState 클래스의 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| DependencyObjectType |
이 인스턴스의 DependencyObjectType CLR 형식을 래핑하는 값을 가져옵니다. (다음에서 상속됨 DependencyObject) |
| Dispatcher |
연결된 이 값을 DispatcherDispatcherObject 가져옵니다. (다음에서 상속됨 DispatcherObject) |
| IsSealed |
이 인스턴스가 현재 봉인되어 있는지 여부를 나타내는 값을 가져옵니다(읽기 전용). (다음에서 상속됨 DependencyObject) |
| Name |
의 이름을 VisualState가져오거나 설정합니다. |
| Storyboard |
컨트롤이 나타내는 상태VisualState일 때 컨트롤의 모양을 정의하는 값을 가져오거나 설정합니다Storyboard. |