VisualStateManager.GoToStateCore メソッド

定義

コントロールは 2 つの状態の間で遷移します。

protected:
 virtual bool GoToStateCore(System::Windows::FrameworkElement ^ control, System::Windows::FrameworkElement ^ stateGroupsRoot, System::String ^ stateName, System::Windows::VisualStateGroup ^ group, System::Windows::VisualState ^ state, bool useTransitions);
protected virtual bool GoToStateCore (System.Windows.FrameworkElement control, System.Windows.FrameworkElement stateGroupsRoot, string stateName, System.Windows.VisualStateGroup group, System.Windows.VisualState state, bool useTransitions);
abstract member GoToStateCore : System.Windows.FrameworkElement * System.Windows.FrameworkElement * string * System.Windows.VisualStateGroup * System.Windows.VisualState * bool -> bool
override this.GoToStateCore : System.Windows.FrameworkElement * System.Windows.FrameworkElement * string * System.Windows.VisualStateGroup * System.Windows.VisualState * bool -> bool
Protected Overridable Function GoToStateCore (control As FrameworkElement, stateGroupsRoot As FrameworkElement, stateName As String, group As VisualStateGroup, state As VisualState, useTransitions As Boolean) As Boolean

パラメーター

control
FrameworkElement

状態を遷移するコントロール。

stateGroupsRoot
FrameworkElement

VisualStateManager を含んでいるルート要素。

stateName
String

遷移後の状態の名前。

group
VisualStateGroup

状態が属する VisualStateGroup

state
VisualState

遷移後の状態の表現。

useTransitions
Boolean

VisualTransition オブジェクトを使用して状態を遷移させる場合は true。それ以外の場合は false

戻り値

Boolean

コントロールが新しい状態に正常に遷移した場合は true。それ以外の場合は false

注釈

このメソッドは GoToStateCore 、遷移に関連付けられているストーリーボードを適切に開始および停止するために必要なロジックを実行します。 コントロールで GoToState を呼び出してその状態を変更すると、VisualStateManager では次のことが行われます。

  • 最初に、コントロールが VisualState 切り替える先のコントロールに a Storyboardがある場合は、ストーリーボードが開始されます。 その後、コントロールの遷移元の VisualStateStoryboard がある場合、そのストーリーボードは終了します。

  • コントロールが既に状態の場合は、アクションを stateName 実行せず、 GoToState 返します true

  • の中に存在しない場合stateNameは、アクションを GoToState ControlTemplate control実行せず、返します。false

独自のロジックを VisualStateManager 実装して、状態間を遷移するためのさまざまなロジックを提供できます。 たとえば、前に説明したロジックを変更したり、カスタム アニメーションの種類間を切り替えるロジックを指定したりできます。 を実装 VisualStateManagerするには、メソッドを VisualStateManager 継承してオーバーライドするクラスを GoToStateCore 作成します。 カスタム クラスを使用するには、プロパティを CustomVisualStateManager カスタム型のオブジェクトに設定します。

適用対象