VisualStateManager.GoToStateCore 메서드

정의

파생 클래스에서 재정의되면 상태 간에 컨트롤을 전환합니다.

protected:
 virtual bool GoToStateCore(Control ^ control, FrameworkElement ^ templateRoot, Platform::String ^ stateName, VisualStateGroup ^ group, VisualState ^ state, bool useTransitions) = GoToStateCore;
bool GoToStateCore(Control const& control, FrameworkElement const& templateRoot, winrt::hstring const& stateName, VisualStateGroup const& group, VisualState const& state, bool const& useTransitions);
protected virtual bool GoToStateCore(Control control, FrameworkElement templateRoot, string stateName, VisualStateGroup group, VisualState state, bool useTransitions);
function goToStateCore(control, templateRoot, stateName, group, state, useTransitions)
Protected Overridable Function GoToStateCore (control As Control, templateRoot As FrameworkElement, stateName As String, group As VisualStateGroup, state As VisualState, useTransitions As Boolean) As Boolean

매개 변수

control
Control

상태 간에 전환할 컨트롤입니다.

templateRoot
FrameworkElement

컨트롤의 ControlTemplate의 루트 요소입니다.

stateName
String

Platform::String

winrt::hstring

변환 후 상태 이름입니다.

group
VisualStateGroup

상태가 속한 VisualStateGroup 입니다.

state
VisualState

변환 후 상태에 대한 표현입니다.

useTransitions
Boolean

bool

True 이면 VisualTransition을 사용하여 상태 간에 전환합니다. 그렇지 않으면 false입니다.

반환

Boolean

bool

컨트롤이 새 상태로 성공적으로 전환되면 true입니다. 그렇지 않으면 false입니다.

설명

이 API는 사용자 지정 VisualStateManager 동작을 정의하는 시나리오의 일부입니다. GoToStateCore를 재정의하면 사용자 지정 클래스 동작의 상태 동작이 변경됩니다.

사용자 지정 VisualStateManager 클래스를 참조하려면 사용자 지정 VisualStateManager 클래스 동작을 사용하려는 컨트롤 템플릿 내에서 VisualStateManager.CustomVisualStateManager 연결된 속성의 값을 설정합니다. 일반적으로 Application.Resources에서 기본 XAML 생성을 통해 사용자 지정 VisualStateManager 클래스의 instance 만듭니다. 그런 다음, 사용자 지정 VisualStateManager 리소스의 키에 대한 {StaticResource} 태그 확장 참조를 사용하여 VisualStateManager.CustomVisualStateManager 연결된 속성이 설정됩니다.

상속자에 대한 참고 사항

사용자 지정 VisualStateManager 클래스의 소비자가 GoToState를 호출하여 컨트롤의 시각적 상태를 변경하는 경우 이는 재정의하는 기본 동작입니다.+ stateName에서 명명된 VisualStateStoryboard가 있는 경우 스토리보드가 시작됩니다.

  • 새로 요청된 상태 이전에 컨트롤이 사용하던 VisualStateStoryboard가 있는 경우 해당 스토리보드가 중지됩니다. stateName에 대한 VisualState그룹에 없는 경우 구현에서 false를 반환해야 합니다.

컨트롤이 stateName으로 요청된 VisualState에 이미 있는 경우 구현은 true를 반환해야 합니다.

기본 동작에 대한 자세한 내용은 GoToState를 참조하세요.

시각적 상태 변경에 대한 이벤트

CurrentStateChangingGoToState 호출에서 요청한 대로 컨트롤이 상태를 전환하기 시작할 때 발생합니다. VisualTransition이 상태 변경에 적용되는 경우 이 이벤트는 전환이 시작될 때 발생합니다.

CurrentStateChanged는 새 Storyboard가 시작되는 것처럼 컨트롤이 GoToState 호출의 요청에 따라 상태가 된 후에 발생합니다. 새 스토리보드 완료 시 이벤트가 발생하지 않습니다.

VisualTransition이 적용되지 않으면 CurrentStateChangingCurrentStateChanged가 연속해서 연속적으로 발생하지만 둘 다 발생하는 경우 해당 순서로 보장됩니다.

그러나 새 GoToState 호출로 인해 상태 변경 전환이 중단되는 경우 첫 번째 상태 전환에 대해 CurrentStateChanged 이벤트가 발생하지 않습니다. 다음 요청된 상태 변경에 대해 새 이벤트 시리즈가 발생합니다.

RaiseCurrentStateChangedRaiseCurrentStateChanging의 동작을 재정의하는 것은 선택 사항입니다. 기본 구현에 의해 이벤트가 발생하는 방법과 시기는 사용자 지정 클래스에 적합할 수 있습니다.

적용 대상

추가 정보