VisualStateGroup 클래스

정의

함께 사용할 수 없는 VisualState 개체와 상태를 전환하는 데 사용되는 VisualTransition 개체를 포함합니다.

public ref class VisualStateGroup : System::Windows::DependencyObject
[System.Windows.Markup.ContentProperty("States")]
[System.Windows.Markup.RuntimeNameProperty("Name")]
public class VisualStateGroup : System.Windows.DependencyObject
[<System.Windows.Markup.ContentProperty("States")>]
[<System.Windows.Markup.RuntimeNameProperty("Name")>]
type VisualStateGroup = class
    inherit DependencyObject
Public Class VisualStateGroup
Inherits DependencyObject
상속
특성

예제

다음 예제에서는 간단한 ControlTemplate 에 대 한는 Button 하나를 포함 하는 Grid합니다. 도 포함 되어 있습니다를 VisualStateGroup 라는 CommonStates를 정의 하는 합니다 MouseOverNormal 상태입니다. VisualStateGroup 역시를 VisualTransition 에 대 한 0.5 초가 걸린다는 점을 지정 하는 합니다 Grid 위로 마우스 포인터를 이동할 때 녹색에서 빨간색으로 변경 하려면를 Button입니다.

<ControlTemplate TargetType="Button">
  <Grid >
    <VisualStateManager.VisualStateGroups>
      <VisualStateGroup x:Name="CommonStates">

        <VisualStateGroup.Transitions>

          <!--Take one half second to trasition to the MouseOver state.-->
          <VisualTransition To="MouseOver" 
            GeneratedDuration="0:0:0.5"/>
        </VisualStateGroup.Transitions>

        <VisualState x:Name="Normal" />

        <!--Change the SolidColorBrush, ButtonBrush, to red when the
            mouse is over the button.-->
        <VisualState x:Name="MouseOver">
          <Storyboard>
            <ColorAnimation Storyboard.TargetName="ButtonBrush" 
              Storyboard.TargetProperty="Color" To="Red" />
          </Storyboard>
        </VisualState>
      </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <Grid.Background>
      <SolidColorBrush x:Name="ButtonBrush" Color="Green"/>
    </Grid.Background>
  </Grid>
</ControlTemplate>

설명

VisualStateGroup 의 컬렉션을 포함 VisualState 개체입니다. A VisualState 의 컬렉션을 포함 Storyboard 컨트롤이 특정 상태에 있을 때 컨트롤의 모양을 변경 하는 방법을 지정 하는 개체입니다. 예를 들어, 한 Button 를 누를 때 보다 누를 때 이와 약간 다르게 표시 해야 할 수 있습니다. 두 개의 상태를 Button 정의 누를 때 해당 하 ("Pressed")이 아닐 때 및 ("Normal").

추가한 VisualState 설정 하 여 컨트롤에는 VisualStateManager.VisualStateGroups 컨트롤에 연결 합니다. 동일한 서로 함께 사용할 수 없는 상태를 추가할 VisualStateGroup합니다. 예를 들어 합니다 CheckBox 에 두 개의 VisualStateGroup 개체입니다. 상태를 포함 하나 Normal, MouseOverPressed, 및 Disabled합니다. 다른 상태를 포함 Checked하십시오 UnChecked, 및 Indeterminate합니다. CheckBox 상태일에서 수 있습니다 MouseOverUnChecked 이와 동시에 있을 수 없습니다 있지만 MouseOverPressed 동시 상태입니다.

추가할 수는 있지만 VisualState 다른 사용자의 시각적 동작을 재정의할 수 있도록 하는 특히 유용한 방법은 요소에 개체를 Control합니다. 사용 하는 사용자 지정 컨트롤을 만드는 경우는 ControlTemplate를 추가 하 여 컨트롤에 적용할 수는 상태를 지정할 수 있습니다는 TemplateVisualStateAttribute 해당 클래스 정의에서. 그런 다음 모든 사용자가 새 ControlTemplate 컨트롤을 추가할 수에 대 한 VisualState 템플릿에 개체입니다. Visual Studio TemplateVisualStateAttribute 및 Blend for Visual Studio 같은 디자이너 도구에서 컨트롤의 상태를 노출할 수 있습니다. 같은 상태 TemplateVisualStateAttribute.GroupName 동일한 속해 VisualStateGroup합니다.

사용 하는 방법에 대 한 자세한 VisualStateGroup 개체를 ControlTemplate를 참조 하십시오 ControlTemplate을 만들어 기존 컨트롤의 모양 사용자 지정합니다. 만드는 방법에 대 한 자세한 내용은 사용 하는 컨트롤에 대해를 VisualStateManager를 참조 하세요 모양을 사용자 지정할 수는 제어 된 만들기합니다.

합니다 Transitions 속성을 포함 VisualTransition 제어 전환 하는 것도 상태 사이 때 적용 되는 개체에 정의 된는 VisualStateGroup합니다.

생성자

VisualStateGroup()

VisualStateGroup 클래스의 새 인스턴스를 초기화합니다.

속성

CurrentState

컨트롤에 현재 적용되는 VisualState를 가져옵니다.

DependencyObjectType

이 인스턴스의 DependencyObjectType CLR 형식을 래핑하는 값을 가져옵니다.

(다음에서 상속됨 DependencyObject)
Dispatcher

Dispatcher와 연결된 DispatcherObject를 가져옵니다.

(다음에서 상속됨 DispatcherObject)
IsSealed

이 인스턴스가 현재 봉인되어 있는지(읽기 전용인지) 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 DependencyObject)
Name

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

States

함께 사용할 수 없는 VisualState 개체의 컬렉션을 가져옵니다.

Transitions

VisualTransition 개체의 컬렉션을 가져옵니다.

메서드

CheckAccess()

호출 스레드가 이 DispatcherObject에 액세스할 수 있는지 여부를 확인합니다.

(다음에서 상속됨 DispatcherObject)
ClearValue(DependencyProperty)

속성의 로컬 값을 지웁니다. 지울 속성이 DependencyProperty 식별자에서 지정됩니다.

(다음에서 상속됨 DependencyObject)
ClearValue(DependencyPropertyKey)

읽기 전용 속성의 로컬 값을 지웁니다. 선언할 속성이 DependencyPropertyKey에서 지정됩니다.

(다음에서 상속됨 DependencyObject)
CoerceValue(DependencyProperty)

지정된 종속성 속성의 값을 강제 변환합니다. 호출하는 DependencyObject에 있으므로 이 작업은 종속성 속성의 속성 메타데이터에 지정된 CoerceValueCallback 함수를 호출하여 수행합니다.

(다음에서 상속됨 DependencyObject)
Equals(Object)

제공된 DependencyObject가 현재 DependencyObject에 해당하는지 여부를 확인합니다.

(다음에서 상속됨 DependencyObject)
GetHashCode()

DependencyObject의 해시 코드를 가져옵니다.

(다음에서 상속됨 DependencyObject)
GetLocalValueEnumerator()

DependencyObject에 대해 로컬로 값을 설정한 종속성 속성을 확인하기 위한 특수 열거자를 만듭니다.

(다음에서 상속됨 DependencyObject)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
GetValue(DependencyProperty)

DependencyObject의 인스턴스에서 종속성 속성의 현재 유효 값을 반환합니다.

(다음에서 상속됨 DependencyObject)
InvalidateProperty(DependencyProperty)

지정된 종속성 속성의 유효 값을 다시 계산합니다.

(다음에서 상속됨 DependencyObject)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
OnPropertyChanged(DependencyPropertyChangedEventArgs)

DependencyObject에서 종속성 속성의 유효 값이 업데이트될 때마다 호출됩니다. 변경된 특정 종속성 속성이 이벤트 데이터에서 보고됩니다.

(다음에서 상속됨 DependencyObject)
ReadLocalValue(DependencyProperty)

종속성 속성의 로컬 값을 반환합니다(있는 경우).

(다음에서 상속됨 DependencyObject)
SetCurrentValue(DependencyProperty, Object)

해당 값 소스를 변경하지 않고 종속성 속성의 값을 설정합니다.

(다음에서 상속됨 DependencyObject)
SetValue(DependencyProperty, Object)

지정된 종속성 속성 식별자를 가진 종속성 속성의 로컬 값을 설정합니다.

(다음에서 상속됨 DependencyObject)
SetValue(DependencyPropertyKey, Object)

종속성 속성의 DependencyPropertyKey 식별자에 의해 지정된 읽기 전용 종속성 속성의 로컬 값을 설정합니다.

(다음에서 상속됨 DependencyObject)
ShouldSerializeProperty(DependencyProperty)

serialization 프로세스에서 지정된 종속성 속성의 값을 직렬화해야 하는지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 DependencyObject)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)
VerifyAccess()

호출 스레드에서 이 DispatcherObject에 액세스할 수 있는지 확인합니다.

(다음에서 상속됨 DispatcherObject)

이벤트

CurrentStateChanged

컨트롤이 다른 상태로 전환된 후에 발생합니다.

CurrentStateChanging

컨트롤이 다른 상태로 전환되기 시작할 때 발생합니다.

적용 대상