XboxGameBarWidget
This object must be created by the application when the widget is activated by Game Bar. This object provides core IPC between Game Bar and the widget, context for future API calls, as well as methods, properties, and events for the widget to manage its state with Game Bar.
XboxGameBarWidget(XboxGameBarWidgetActivatedEventArgs args, Windows.UI.Core.CoreWindow coreWindow, Windows.UI.Xaml.Controls.Frame frame);
XboxGameBarDisplayMode GameBarDisplayMode
Determine the XboxGameBarDisplayMode state. This value indicates whether the widget is currently pinned to the screen, or is running in the foreground.
Windows.UI.Xaml.ElementTheme RequestedTheme
Returns the ElementTheme
requested by Game Bar. Honor the theme if your widget is able. Subscribe to RequestedThemeChanged
event to monitor changes.
double RequestedOpacity
This is value represents the users settings for requested opacity. It is presented on a scale of 0-100, where 0 is completely transparent, and 100 is fully opaque. This value changes based on Game Bars current XboxGameBarDisplayMode](./enum-xgb-displaymode.md). [This property was introduced in 5.3]
Boolean ClickThroughEnabled
Specifies if the click-through feature is enabled by the user. [This property was introduced in 5.3]
Windows.Foundation.Rect WindowsBounds
Returns the Window Bounds for the widget. You can use this to get the positioning of your widget on the display.
Boolean CompactModeEnabled
Specifies if Game Bar is in the compact mode state. Subscribe to CompactModeEnabledChanged
event to monitor changes.
String AppExtensionId
Returns the App Extension Id that this object represents. This is the Id from the <AppExtension>
element in the app's package manifest.
Boolean Favorited
Determine if the widget has been set as a favorite.
Boolean Pinned
Determine if the widget is currently set as pinned.
Boolean Visible
Returns whether your widget is currently visible to the user or not. Subscribe to VisibleChanged
event to monitor changes. This is a composite
property derived based on the state of GameBarDisplayMode
, WindowState
, and Pinned
states.
XboxGameBarWidgetWindowState WindowState
Determine the current XboxGameBarWidgetWindowState
Boolean PinningSupported / PinningSupported(Boolean value)
Set this property to tell Game Bar whether the widget can be pinned. If set to 'true', the title bar will display the pin button.
Boolean SettingsSupported / SettingsSupported(Boolean value)
Set this property to tell Game Bar whether the widget currently supports settings. If set to 'true', the title bar will display the settings button.
Windows.Foundation.Size MinWindowSize / MinWindowSize(Windows.Foundation.Size value)
Set this property to tell Game Bar the min Window size the widget currently supports.
Windows.Foundation.Size MaxWindowSize / MaxWindowSize(Windows.Foundation.Size value)
Set this property to tell Game Bar the max Window size the widget currently supports.
Boolean HorizontalResizeSupported / HorizontalResizeSupported(Boolean value)
Set this property to tell Game Bar whether the widget can currently be horizontally resized.
Boolean VerticalResizeSupported / VerticalResizeSupported(Boolean value)
Set this property to tell Game Bar whether the widget can currently be vertically resized.
Windows.Foundation.IAsyncAction ActivateSettingsAsync();
Open the settings widget associated with this widget.
Windows.Foundation.IAsyncAction ActivateSettingsWithUriAsync(Windows.Foundation.Uri uri);
Open the settings widget associated with this widget using the Uri provided.
void Close();
Close this widget.
Windows.Foundation.IAsyncAction MinimizeAsync();
Minimize this widget.
Windows.Foundation.IAsyncAction RestoreAsync();
Restore this widget.
Windows.Foundation.IAsyncOperation<Boolean> TryResizeWindowAsync(Windows.Foundation.Size size);
Requests Game Bar resize your window to the requested size.
Windows.Foundation.IAsyncAction CenterWindowAsync();
Requests Game Bar center the position of your window. This centers the hosted content of your widget, so the center of your hosted content will be in the center of the screen. Note: If centering the widget violates bounds requirements (collision with Home Bar or edge of screen), your widget will be auto sized or moved to fit, and may not be centered.
Windows.Foundation.IAsyncOperation<bool> LaunchUriAsync(Windows.Foundation.Uri uri);
Starts the default app associated with the URI scheme name for the specified URI.
Windows.Foundation.IAsyncOperation<bool> LaunchUriAsync(Windows.Foundation.Uri uri, Windows.System.LauncherOptions options);
Starts the default app associated with the URI scheme name for the specified URI, using the specified options.
Windows.Foundation.IAsyncOperation<bool> LaunchUriAsync(Windows.Foundation.Uri uri, Windows.System.LauncherOptions options, Windows.Foundation.Collections.ValueSet inputData);
Starts the default app associated with the URI scheme name for the specified URI, using the specified options and input data.
See LaunchUriAsync (Windows) for comparable reference.
event Windows.Foundation.TypedEventHandler<XboxGameBarWidget, Object> ClickThroughEnabledChanged;
Notification for ClickThroughEnabled
changed events.
event Windows.Foundation.TypedEventHandler<XboxGameBarWidget, Object> GameBarDisplayModeChanged;
Notification for GameBarDisplayMode
changed events.
event Windows.Foundation.TypedEventHandler<XboxGameBarWidget, Object> RequestedThemeChanged;
Notification for RequestedTheme
changed events.
event Windows.Foundation.TypedEventHandler<XboxGameBarWidget, Object> FavoritedChanged
Notification for Favorited
changed events.
event Windows.Foundation.TypedEventHandler<XboxGameBarWidget, Object> SettingsClicked
Notification for when the user clicks the settings button in the widget title bar.
event Windows.Foundation.TypedEventHandler<XboxGameBarWidget, Object> VisibleChanged
Notification for when the Visible
property changes.
event Windows.Foundation.TypedEventHandler<XboxGameBarWidget, Object> WindowStateChanged;
Notification for when the XboxGameBarWidgetWindowState changes.
event Windows.Foundation.TypedEventHandler<XboxGameBarWidget, Object> RequestedOpacityChanged;
Notification for the RequestedOpacity
changed events. [This event was introduced in 5.3 SDK]
event Windows.Foundation.TypedEventHandler<XboxGameBarWidget, Object> CompactModeEnabledChanged
Notification for CompactModeEnabled
changed events.