Share via


GameBar.VisibilityChanged Event

Definition

Occurs when Game bar is shown or dismissed.

Use the event to monitor the visibility state of Game bar. Games can choose to pause gameplay or present an idle state when Game bar is visible and being drawn over the game. While paused or idle, a best practice is to continue rendering the current frame or scene, so that the recording is smooth and seamless if the player begins recording or is already recording. Multiplayer games might choose to continue gameplay rather than to pause.

Tip

This event can be raised on background (non-UI) threads. You may need to post an event to the UI thread to perform UI actions.

Use Visible to determine whether Game bar is currently visible.

// Register
static event_token VisibilityChanged(EventHandler<IInspectable> const& handler) const;

// Revoke with event_token
static void VisibilityChanged(event_token const* cookie) const;

// Revoke with event_revoker
static GameBar::VisibilityChanged_revoker VisibilityChanged(auto_revoke_t, EventHandler<IInspectable> const& handler) const;
public static event System.EventHandler<object> VisibilityChanged;
function onVisibilityChanged(eventArgs) { /* Your code */ }
Windows.Gaming.UI.GameBar.addEventListener("visibilitychanged", onVisibilityChanged);
Windows.Gaming.UI.GameBar.removeEventListener("visibilitychanged", onVisibilityChanged);
- or -
Windows.Gaming.UI.GameBar.onvisibilitychanged = onVisibilityChanged;
Public Shared Custom Event VisibilityChanged As EventHandler(Of Object) 

Event Type

Applies to

See also