Window.Activated 이벤트

정의

창이 성공적으로 활성화되었을 때 발생합니다.

// Register
event_token Activated(TypedEventHandler<IInspectable, WindowActivatedEventArgs const&> const& handler) const;

// Revoke with event_token
void Activated(event_token const* cookie) const;

// Revoke with event_revoker
Window::Activated_revoker Activated(auto_revoke_t, TypedEventHandler<IInspectable, WindowActivatedEventArgs const&> const& handler) const;
public event TypedEventHandler<object,WindowActivatedEventArgs> Activated;
function onActivated(eventArgs) { /* Your code */ }
window.addEventListener("activated", onActivated);
window.removeEventListener("activated", onActivated);
- or -
window.onactivated = onActivated;
Public Custom Event Activated As TypedEventHandler(Of Object, WindowActivatedEventArgs) 

이벤트 유형

예제

다음 코드 예제에서는이 이벤트에 대 한 일반적인 사용 패턴을 보여 줍니다.

void Current_Activated(object sender, WindowActivatedEventArgs e)
{
    if (e.WindowActivationState == WindowActivationState.Deactivated)
    {
        // Show the "paused" UI. 
        VisualStateManager.GoToState(this, "PauseUI", false);
    }
    else if (e.WindowActivationState == WindowActivationState.PointerActivated 
    || e.WindowActivationState == WindowActivationState.CodeActivated)
    {
        // Show the "active" UI. 
        VisualStateManager.GoToState(this, "ActivateUI", false);
    }
}

설명

이 이벤트는 시스템에서 Window 를 활성화하거나 비활성화할 때 발생합니다. 앱은 WindowActivationState 속성을 확인하여 활성화의 Window 상태 확인할 수 있습니다. 은 Window 화면에 표시될 수 있지만 활성화되지 않을 수 있습니다(예: 스냅된 앱). 또한 시스템의 다른 부분이 창에서 포커스를 벗어나면 이 이벤트가 발생합니다. 이는 사용자 상호 작용 또는 코드의 결과로 발생할 수 있으며 WindowActivationState 는 수행된 작업을 나타냅니다.

적용 대상

추가 정보