Application​View​Switcher Application​View​Switcher Application​View​Switcher Application​View​Switcher Class

Definition

Represents the app view switching behaviors for an app.

public : static class ApplicationViewSwitcherpublic static class ApplicationViewSwitcherPublic Static Class ApplicationViewSwitcher// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Methods

DisableShowingMainViewOnActivation() DisableShowingMainViewOnActivation() DisableShowingMainViewOnActivation() DisableShowingMainViewOnActivation()

Disables the primary window (app view) when the app is activated, showing the most recently displayed window instead.

public : static void DisableShowingMainViewOnActivation()public static void DisableShowingMainViewOnActivation()Public Static Function DisableShowingMainViewOnActivation() As void// You can use this method in JavaScript.

Remarks

By default, the app object displays the main window of the app when it is first activated. This method forces the app to display the most recently displayed window upon subsequent activations. Note that the app must call this method before completing the first non-hosted activation, and the app must also only call CoreWindow.Activate for hosted activations from the UI thread of the displayed window.

See Also

DisableSystemViewActivationPolicy() DisableSystemViewActivationPolicy() DisableSystemViewActivationPolicy() DisableSystemViewActivationPolicy()

Disables Windows shell control of the view selection on activation, and lets the app handle it instead.

public : static void DisableSystemViewActivationPolicy()public static void DisableSystemViewActivationPolicy()Public Static Function DisableSystemViewActivationPolicy() As void// You can use this method in JavaScript.

PrepareForCustomAnimatedSwitchAsync(Int32, Int32, ApplicationViewSwitchingOptions) PrepareForCustomAnimatedSwitchAsync(Int32, Int32, ApplicationViewSwitchingOptions) PrepareForCustomAnimatedSwitchAsync(Int32, Int32, ApplicationViewSwitchingOptions) PrepareForCustomAnimatedSwitchAsync(Int32, Int32, ApplicationViewSwitchingOptions)

Prepares your app to visually transition between two windows with a custom animation.

public : static IAsyncOperation<PlatForm::Boolean> PrepareForCustomAnimatedSwitchAsync(int toViewId, int fromViewId, ApplicationViewSwitchingOptions options)public static IAsyncOperation<bool> PrepareForCustomAnimatedSwitchAsync(Int32 toViewId, Int32 fromViewId, ApplicationViewSwitchingOptions options)Public Static Function PrepareForCustomAnimatedSwitchAsync(toViewId As Int32, fromViewId As Int32, options As ApplicationViewSwitchingOptions) As IAsyncOperation( Of bool )// You can use this method in JavaScript.
Parameters
toViewId
int Int32 Int32 Int32

The ID of the window from which your app is transitioning.

fromViewId
int Int32 Int32 Int32

The ID of the window to which your app is transitioning.

Returns

Asynchronously returns true if the call succeeds; false if it does not.

Remarks

The view ID can be obtained for the current app view with ApplicationView.Id. For a specific app view managed by the app, call ApplicationView.GetApplicationViewIdForWindow with the CoreWindow for the app view.

SwitchAsync(Int32) SwitchAsync(Int32) SwitchAsync(Int32) SwitchAsync(Int32)

Visually replaces the calling window (app view) with a specified window.

public : static IAsyncAction SwitchAsync(int viewId)public static IAsyncAction SwitchAsync(Int32 viewId)Public Static Function SwitchAsync(viewId As Int32) As IAsyncAction// You can use this method in JavaScript.
Parameters
viewId
int Int32 Int32 Int32

The ID of the window under preparation for display.

Returns

The asynchronous results of the operation. Use this to determine when the async call is complete.

See Also

SwitchAsync(Int32, Int32) SwitchAsync(Int32, Int32) SwitchAsync(Int32, Int32) SwitchAsync(Int32, Int32)

Visually replaces the calling window (app view) with a specified window.

public : static IAsyncAction SwitchAsync(int toViewId, int fromViewId)public static IAsyncAction SwitchAsync(Int32 toViewId, Int32 fromViewId)Public Static Function SwitchAsync(toViewId As Int32, fromViewId As Int32) As IAsyncAction// You can use this method in JavaScript.
Parameters
toViewId
int Int32 Int32 Int32

The ID of the window under preparation for display.

fromViewId
int Int32 Int32 Int32

The ID of the calling, currently displayed window.

Returns

The asynchronous results of the operation. Use this to determine when the async call is complete.

See Also

SwitchAsync(Int32, Int32, ApplicationViewSwitchingOptions) SwitchAsync(Int32, Int32, ApplicationViewSwitchingOptions) SwitchAsync(Int32, Int32, ApplicationViewSwitchingOptions) SwitchAsync(Int32, Int32, ApplicationViewSwitchingOptions)

Visually replaces the calling window (app view) with a specified window.

public : static IAsyncAction SwitchAsync(int toViewId, int fromViewId, ApplicationViewSwitchingOptions options)public static IAsyncAction SwitchAsync(Int32 toViewId, Int32 fromViewId, ApplicationViewSwitchingOptions options)Public Static Function SwitchAsync(toViewId As Int32, fromViewId As Int32, options As ApplicationViewSwitchingOptions) As IAsyncAction// You can use this method in JavaScript.
Parameters
toViewId
int Int32 Int32 Int32

The ID of the window under preparation for display.

fromViewId
int Int32 Int32 Int32

The ID of the calling, currently displayed window.

Returns

The asynchronous results of the operation. Use this to determine when the async call is complete.

See Also

TryShowAsStandaloneAsync(Int32) TryShowAsStandaloneAsync(Int32) TryShowAsStandaloneAsync(Int32) TryShowAsStandaloneAsync(Int32)

Displays another window (app view) for the app on the screen, adjacent to the original window

public : static IAsyncOperation<PlatForm::Boolean> TryShowAsStandaloneAsync(int viewId)public static IAsyncOperation<bool> TryShowAsStandaloneAsync(Int32 viewId)Public Static Function TryShowAsStandaloneAsync(viewId As Int32) As IAsyncOperation( Of bool )// You can use this method in JavaScript.
Parameters
viewId
int Int32 Int32 Int32

The ID of the new window to display.

Returns

Asynchronously returns true if the call succeeds; false if it does not.

Remarks

If this method succeeds, a new window is created next to the original window. It can only be called from an ASTA (core UI) thread.

The new window has its own UI thread (ASTA) and associated CoreWindow. Developers should use thread-safe methods for communication between the windows, such as window.postMessage for JavaScript apps and the CoreDispatcher (CoreWindow.Dispatcher ) messaging for C# and C++ developers.

See Also

TryShowAsStandaloneAsync(Int32, ViewSizePreference) TryShowAsStandaloneAsync(Int32, ViewSizePreference) TryShowAsStandaloneAsync(Int32, ViewSizePreference) TryShowAsStandaloneAsync(Int32, ViewSizePreference)

Displays another window (app view) for the app on the screen, adjacent to the original window

public : static IAsyncOperation<PlatForm::Boolean> TryShowAsStandaloneAsync(int viewId, ViewSizePreference sizePreference)public static IAsyncOperation<bool> TryShowAsStandaloneAsync(Int32 viewId, ViewSizePreference sizePreference)Public Static Function TryShowAsStandaloneAsync(viewId As Int32, sizePreference As ViewSizePreference) As IAsyncOperation( Of bool )// You can use this method in JavaScript.
Parameters
viewId
int Int32 Int32 Int32

The ID of the new window to display.

sizePreference
ViewSizePreference ViewSizePreference ViewSizePreference ViewSizePreference

The preferred general sizing of the new window.

Returns

Asynchronously returns true if the call succeeds; false if it does not.

Remarks

If this method succeeds, a new window is created next to the original window. It can only be called from an ASTA (core UI) thread.

The new window has its own UI thread (ASTA) and associated CoreWindow. Developers should use thread-safe methods for communication between the windows, such as window.postMessage for JavaScript apps and the CoreDispatcher (CoreWindow.Dispatcher ) messaging for C# and C++ developers.

See Also

TryShowAsStandaloneAsync(Int32, ViewSizePreference, Int32, ViewSizePreference) TryShowAsStandaloneAsync(Int32, ViewSizePreference, Int32, ViewSizePreference) TryShowAsStandaloneAsync(Int32, ViewSizePreference, Int32, ViewSizePreference) TryShowAsStandaloneAsync(Int32, ViewSizePreference, Int32, ViewSizePreference)

Displays another window (app view) for the app on the screen, adjacent to the original window.

public : static IAsyncOperation<PlatForm::Boolean> TryShowAsStandaloneAsync(int viewId, ViewSizePreference sizePreference, int anchorViewId, ViewSizePreference anchorSizePreference)public static IAsyncOperation<bool> TryShowAsStandaloneAsync(Int32 viewId, ViewSizePreference sizePreference, Int32 anchorViewId, ViewSizePreference anchorSizePreference)Public Static Function TryShowAsStandaloneAsync(viewId As Int32, sizePreference As ViewSizePreference, anchorViewId As Int32, anchorSizePreference As ViewSizePreference) As IAsyncOperation( Of bool )// You can use this method in JavaScript.
Parameters
viewId
int Int32 Int32 Int32

The ID of the new window to display.

sizePreference
ViewSizePreference ViewSizePreference ViewSizePreference ViewSizePreference

The preferred general sizing of the new window.

anchorViewId
int Int32 Int32 Int32

The ID of the calling (anchor) window.

anchorSizePreference
ViewSizePreference ViewSizePreference ViewSizePreference ViewSizePreference

The preferred new general sizing of the calling window if this call succeeds.

Returns

Asynchronously returns true if the call succeeds; false if it does not.

Remarks

If this method succeeds, a new window is created next to the original window. It can only be called from an ASTA (core UI) thread.

The new window has its own UI thread (ASTA) and associated CoreWindow. Developers should use thread-safe methods for communication between the windows, such as window.postMessage for JavaScript apps and the CoreDispatcher (CoreWindow.Dispatcher ) messaging for C# and C++ developers.

See Also

TryShowAsViewModeAsync(Int32, ApplicationViewMode) TryShowAsViewModeAsync(Int32, ApplicationViewMode) TryShowAsViewModeAsync(Int32, ApplicationViewMode) TryShowAsViewModeAsync(Int32, ApplicationViewMode)

Displays a view as a standalone view in the desired view mode.

public : static IAsyncOperation<PlatForm::Boolean> TryShowAsViewModeAsync(int viewId, ApplicationViewMode viewMode)public static IAsyncOperation<bool> TryShowAsViewModeAsync(Int32 viewId, ApplicationViewMode viewMode)Public Static Function TryShowAsViewModeAsync(viewId As Int32, viewMode As ApplicationViewMode) As IAsyncOperation( Of bool )// You can use this method in JavaScript.
Parameters
viewId
int Int32 Int32 Int32

The ID of the window to display.

viewMode
ApplicationViewMode ApplicationViewMode ApplicationViewMode ApplicationViewMode

The desired view mode for the window.

Returns

Asynchronously returns true if the call succeeds; false if it does not.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

If this method succeeds, a new window is created next to the original window. It can only be called from an ASTA (core UI) thread.

The new window has its own UI thread (ASTA) and associated CoreWindow. Developers should use thread-safe methods for communication between the windows, such as window.postMessage for JavaScript apps and the CoreDispatcher (CoreWindow.Dispatcher ) messaging for C# and C++ developers.

TryShowAsViewModeAsync(Int32, ApplicationViewMode, ViewModePreferences) TryShowAsViewModeAsync(Int32, ApplicationViewMode, ViewModePreferences) TryShowAsViewModeAsync(Int32, ApplicationViewMode, ViewModePreferences) TryShowAsViewModeAsync(Int32, ApplicationViewMode, ViewModePreferences)

Displays a view as a standalone view in the desired view mode with the specified options.

public : static IAsyncOperation<PlatForm::Boolean> TryShowAsViewModeAsync(int viewId, ApplicationViewMode viewMode, ViewModePreferences viewModePreferences)public static IAsyncOperation<bool> TryShowAsViewModeAsync(Int32 viewId, ApplicationViewMode viewMode, ViewModePreferences viewModePreferences)Public Static Function TryShowAsViewModeAsync(viewId As Int32, viewMode As ApplicationViewMode, viewModePreferences As ViewModePreferences) As IAsyncOperation( Of bool )// You can use this method in JavaScript.
Parameters
viewId
int Int32 Int32 Int32

The ID of the window to display.

viewMode
ApplicationViewMode ApplicationViewMode ApplicationViewMode ApplicationViewMode

The desired view mode for the window.

viewModePreferences
ViewModePreferences ViewModePreferences ViewModePreferences ViewModePreferences

Preferred settings for the desired view mode.

Returns

Asynchronously returns true if the call succeeds; false if it does not.

Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

If this method succeeds, a new window is created next to the original window. It can only be called from an ASTA (core UI) thread.

The new window has its own UI thread (ASTA) and associated CoreWindow. Developers should use thread-safe methods for communication between the windows, such as window.postMessage for JavaScript apps and the CoreDispatcher (CoreWindow.Dispatcher ) messaging for C# and C++ developers.

See Also