Application​View Application​View Application​View Class

Definition

Represents the active application view and associated states and behaviors.

public : sealed class ApplicationView : IApplicationView, IApplicationView2, IApplicationView3, IApplicationView4public sealed class ApplicationView : IApplicationView, IApplicationView2, IApplicationView3, IApplicationView4Public NotInheritable Class ApplicationView Implements IApplicationView, IApplicationView2, IApplicationView3, IApplicationView4
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

A window (also called an app view) is the displayed portion of a Windows Runtime app. On Windows, a user's screen can have up to 4 windows of variable width displayed simultaneously. They do not overlap, and their top and bottom edges touch the top and bottom edges of the screen. There may be non-window areas between adjacent windows.

The window is not the same thing as the current page of the application. It is better thought of as the container of the pages; you can use the window reference in your program for all the pages of the application.

Each window has a corresponding CoreWindow that represents the UI processing thread (including the core input handlers and event dispatcher) for the window.

You can use the properties (or methods, for JavaScript) of the window in configuring your pages. For example: the Orientation property tells you whether the window is portrait or landscape; for Windows the AdjacentToLeftDisplayEdge property tells you whether the left edge of the screen is the left border of the window; and the isFullScreen method tells you whether the window uses the entire screen. For examples of using these methods, see the Application Views sample.

To obtain an object of this type, call ApplicationView.GetForCurrentView.

Note

Do not use the value returned in the Value ApplicationView.Value property when creating a page layout. This method is deprecated and may not be available in future releases.

Properties

AdjacentToLeftDisplayEdge AdjacentToLeftDisplayEdge AdjacentToLeftDisplayEdge

Gets a value that indicates whether the current window is in close proximity to the left edge of the screen.

public : PlatForm::Boolean AdjacentToLeftDisplayEdge { get; }public bool AdjacentToLeftDisplayEdge { get; }Public ReadOnly Property AdjacentToLeftDisplayEdge As bool
Value
PlatForm::Boolean bool bool

true if the current window is in close proximity to the left edge of the screen; otherwise, false.

Attributes

Remarks

The system raises the CoreWindow.SizeChanged event when the value of this property changes. This is exposed to XAML apps as the Window.SizeChanged event and to HTML apps as the window.resize event.

The property is a nonstatic member of the window object. For JavaScript, this means that it is a method of the window object that getForCurrentView creates, not of the ApplicationView class.

AdjacentToRightDisplayEdge AdjacentToRightDisplayEdge AdjacentToRightDisplayEdge

Gets a value that indicates whether the current window is in close proximity to the right edge of the screen.

public : PlatForm::Boolean AdjacentToRightDisplayEdge { get; }public bool AdjacentToRightDisplayEdge { get; }Public ReadOnly Property AdjacentToRightDisplayEdge As bool
Value
PlatForm::Boolean bool bool

true if the current window is in close proximity to the right edge of the screen; otherwise, false.

Attributes

Remarks

The system raises the CoreWindow.SizeChanged event when the value of this property changes. This is exposed to XAML apps as the Window.SizeChanged event and to HTML apps as the window.resize event.

The property is a nonstatic member of the window object. For JavaScript, this means that it is a method of the window object that getForCurrentView creates, not of the ApplicationView class.

DesiredBoundsMode DesiredBoundsMode DesiredBoundsMode

Gets a value that indicates the bounds used by the framework to lay out the contents of the window (app view).

public : ApplicationViewBoundsMode DesiredBoundsMode { get; }public ApplicationViewBoundsMode DesiredBoundsMode { get; }Public ReadOnly Property DesiredBoundsMode As ApplicationViewBoundsMode
Value
ApplicationViewBoundsMode ApplicationViewBoundsMode ApplicationViewBoundsMode

The current layout bounds of the window. The default is UseVisible.

Attributes

FullScreenSystemOverlayMode FullScreenSystemOverlayMode FullScreenSystemOverlayMode

Gets or sets a value that indicates how an app in full-screen mode responds to edge swipe actions.

public : FullScreenSystemOverlayMode FullScreenSystemOverlayMode { get; set; }public FullScreenSystemOverlayMode FullScreenSystemOverlayMode { get; set; }Public ReadWrite Property FullScreenSystemOverlayMode As FullScreenSystemOverlayMode
Value
FullScreenSystemOverlayMode FullScreenSystemOverlayMode FullScreenSystemOverlayMode

An enumeration value that indicates how an app in full-screen mode responds to edge swipe actions.

Attributes
See Also

Id Id Id

Gets the ID of the window (app view).

public : int Id { get; }public int Id { get; }Public ReadOnly Property Id As int
Value
int int int

The ID of the window. It is unique for all windows managed by the app.

Attributes

Remarks

The property is a nonstatic member of the window object. For JavaScript, this means that it is a property of the window object that getForCurrentView creates, not of the ApplicationView class.

IsFullScreen IsFullScreen IsFullScreen

Note

IsFullScreen may be altered or unavailable for releases after Windows 10. Instead, use IsFullScreenMode.

Gets a value that indicates whether the window touches both the left and right sides of the display.

public : PlatForm::Boolean IsFullScreen { get; }public bool IsFullScreen { get; }Public ReadOnly Property IsFullScreen As bool
Value
PlatForm::Boolean bool bool

true if the window touches both the left and right sides of the display; otherwise, false.

Attributes

Remarks

The system raises the CoreWindow.SizeChanged event when the value of this property changes. This is exposed to XAML apps as the Window.SizeChanged event and to HTML apps as the window.resize event.

The property is a nonstatic member of the window object. For JavaScript, this means that it is a property of the window object that getForCurrentView creates, not of the ApplicationView class.

Windows 10 In Windows 10, apps run in resizable windows and this property is deprecated. To check if the app is full screen, use the IsFullScreenMode property. To check if the app is close to the edges of the display, use the AdjacentToLeftDisplayEdge and AdjacentToRightDisplayEdge properties.

Windows 8 In Windows 8, apps always use the full height of the screen, so this property returns true if the app touches both sides of the display.

IsFullScreenMode IsFullScreenMode IsFullScreenMode

Gets a value that indicates whether the app is running in full-screen mode.

public : PlatForm::Boolean IsFullScreenMode { get; }public bool IsFullScreenMode { get; }Public ReadOnly Property IsFullScreenMode As bool
Value
PlatForm::Boolean bool bool

true if the app is running in full-screen mode; otherwise, false. The default is false.

Attributes

Remarks

The IsFullScreenMode property is set as a result of calls to the TryEnterFullScreenMode and ExitFullScreenMode methods. It can also be set to true when the app starts if the PreferredLaunchWindowingMode property is set to FullScreen.

The system raises the CoreWindow.SizeChanged event when the value of this property changes. This is exposed to XAML apps as the Window.SizeChanged event and to HTML apps as the window.resize event.

User experience

Full-screen mode is not the same as maximized or Tablet Mode. (Tablet Mode is a feature of Continuum.) When an app is in full-screen mode, it takes up the entirety of the screen. System elements, like title bars, status bars, or the taskbar, are hidden by default. In cases where a windowed mode is not available and apps always fill the entire screen, such as on phones or devices in Tablet Mode, full-screen mode still causes the system elements to be hidden.

When the user switches away from the app to use another app, the full-screen nature of the app is preserved. When the user switches to the app again, it is full-screen.

In full-screen mode:

  • On the mobile device family, the user can swipe from the bottom to bring up the navigation bar (Back, Start, Cortana). They can also swipe from the top to bring up Action Center.
  • On the desktop device family, the user can swipe from the bottom to bring up the navigation bar (taskbar). They can swipe from the left to bring up Task View, from the right to bring up Action Center, and from the top to bring up the title bar.

You can suppress edge swipes and show a small UI instead by setting FullScreenSystemOverlayMode to Minimal.

To play media full-screen, don't use full-screen mode. Set the MediaPlayer.IsFullWindow property instead.

See Also

IsOnLockScreen IsOnLockScreen IsOnLockScreen

Gets whether the window (app view) is on the Windows lock screen.

public : PlatForm::Boolean IsOnLockScreen { get; }public bool IsOnLockScreen { get; }Public ReadOnly Property IsOnLockScreen As bool
Value
PlatForm::Boolean bool bool

true if the calling window is on the lock screen; false if it is not.

Attributes

Remarks

The property is a nonstatic member of the window object. For JavaScript, this means that it is a method of the window object that getForCurrentView creates, not of the ApplicationView class.

IsScreenCaptureEnabled IsScreenCaptureEnabled IsScreenCaptureEnabled

Gets or sets whether screen capture is enabled for the window (app view).

public : PlatForm::Boolean IsScreenCaptureEnabled { get; set; }public bool IsScreenCaptureEnabled { get; set; }Public ReadWrite Property IsScreenCaptureEnabled As bool
Value
PlatForm::Boolean bool bool

true if screen capture is enabled for the window; false if it is not.

Attributes

Remarks

This property lets you protect against unwanted copies of the window. When screen capture is disabled for a window, the window appears black in images produced by screen capture operations. For an example of setting the isScreenCaptureEnabled property, see the Disable screen capture sample.

The property is a nonstatic member of the window object. For JavaScript, this means that it is a method of the window object that getForCurrentView creates, not of the ApplicationView class.

See Also

Orientation Orientation Orientation

Gets the current orientation (landscape or portrait) of the window (app view) with respect to the display.

public : ApplicationViewOrientation Orientation { get; }public ApplicationViewOrientation Orientation { get; }Public ReadOnly Property Orientation As ApplicationViewOrientation
Value
ApplicationViewOrientation ApplicationViewOrientation ApplicationViewOrientation

The current orientation of the calling window.

Attributes

Remarks

For an example of using the Orientation property, see the Application Views sample.

The property is a nonstatic member of the window object. For JavaScript, this means that it is a method of the window object that getForCurrentView creates, not of the ApplicationView class.

PreferredLaunchViewSize PreferredLaunchViewSize PreferredLaunchViewSize

Gets or sets the size that the app launches with when the ApplicationView.PreferredLaunchWindowingMode property is set to PreferredLaunchViewSize, except in cases where the system manages the window size directly.

public : static Size PreferredLaunchViewSize { get; set; }public static Size PreferredLaunchViewSize { get; set; }Public Static ReadWrite Property PreferredLaunchViewSize As Size
Value
Size Size Size

The size that the app launches with when the ApplicationView.PreferredLaunchWindowingMode property is set to PreferredLaunchViewSize, except in cases where the system manages the window size directly.

Attributes

Remarks

This property only has an effect when the app is launched on a desktop device that is not in Tablet mode.

See Also

PreferredLaunchWindowingMode PreferredLaunchWindowingMode PreferredLaunchWindowingMode

Gets or sets a value that indicates the windowing mode the app launches with.

public : static ApplicationViewWindowingMode PreferredLaunchWindowingMode { get; set; }public static ApplicationViewWindowingMode PreferredLaunchWindowingMode { get; set; }Public Static ReadWrite Property PreferredLaunchWindowingMode As ApplicationViewWindowingMode
Value
ApplicationViewWindowingMode ApplicationViewWindowingMode ApplicationViewWindowingMode

An enumeration value that indicates the windowing mode of the app.

Attributes

Examples

This example shows how to toggle full-screen mode and set the PreferredLaunchWindowingMode property.

<Button x:Name="ToggleFullScreenModeButton" Content="Toggle full screen" 
        Click="ToggleFullScreenModeButton_Click">
private void ToggleFullScreenModeButton_Click(object sender, RoutedEventArgs e)
{
    var view = ApplicationView.GetForCurrentView();
    if (view.IsFullScreenMode)
    {
        view.ExitFullScreenMode();
        ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
        // The SizeChanged event will be raised when the exit from full-screen mode is complete.
    }
    else
    {
        if (view.TryEnterFullScreenMode())
        {
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
            // The SizeChanged event will be raised when the entry to full-screen mode is complete.
        }
    }
}

Remarks

By default, PreferredLaunchWindowingMode is set to Auto. In this mode, the size and position of your app window on startup is managed automatically by Windows.

You can set PreferredLaunchWindowingMode to override the automatic behavior with one of these values.

You typically set this property when the user sets their preference via an in-app option, or when you call TryEnterFullScreenMode and ExitFullScreenMode. You can set this property during app startup (before the call to CoreWindow.Activate ) to specify a first launch behavior. However, you shouldn't set it during every launch as this can cause your app to do extra sizing and positioning work during startup.

See Also

SuppressSystemOverlays SuppressSystemOverlays SuppressSystemOverlays

Note

SuppressSystemOverlays may be altered or unavailable for releases after Windows 10. Instead, use TryEnterFullScreenMode and FullScreenSystemOverlayMode.

Gets or sets a value indicating whether or not system overlays (such as overlay applications or the soft steering wheel) should be shown.

public : PlatForm::Boolean SuppressSystemOverlays { get; set; }public bool SuppressSystemOverlays { get; set; }Public ReadWrite Property SuppressSystemOverlays As bool
Value
PlatForm::Boolean bool bool

true if system overlays (such as overlay applications or the soft steering wheel) should be shown; otherwise, false.

Attributes

Remarks

Windows 10 For Universal Windows Platform (UWP) app on Windows 10, this property is deprecated. This property has an effect only on the mobile device family.

To launch your app in full screen mode, set PreferredLaunchWindowingMode to FullScreen. To enter full screen mode after your app is launched, call TryEnterFullScreenMode. To exit full screen mode, call ExitFullScreenMode.

To suppress edge gestures, set FullScreenSystemOverlayMode to Minimal.

Windows Phone 8.1 You can set your app to "full-screen" by setting this property to true. A full-screen app, such as a game, is not occluded by overlay apps. An overlay app is one that shows its UI in the Overlay Layer, which is positioned in a layer above the app and lock layers, but below certain other chrome elements (such as the SIP). An example of an overlay app is an instant messaging app that displays a UI that overlays the app below.

In addition, by setting SuppressSystemOverlays to true, accidental taps of the Search button are far less likely to affect the app. When SuppressSystemOverlays is set to true, the user must tap the Search button twice in close succession to actuate the Search experience, which overlays the running app. We recommend using this property to opt into this behavior only in these cases: user feedback shows that accidental taps of the Search button are likely based on the layout of your app; if your app shows full-screen media content; or if your app uses camera functionality or the viewfinder.

SuppressSystemOverlays is true by default for an app associated with the Games category, and false by default for an application associated with any other category.

TerminateAppOnFinalViewClose TerminateAppOnFinalViewClose TerminateAppOnFinalViewClose

Indicates whether the app terminates when the last window is closed.

public : static PlatForm::Boolean TerminateAppOnFinalViewClose { get; set; }public static bool TerminateAppOnFinalViewClose { get; set; }Public Static ReadWrite Property TerminateAppOnFinalViewClose As bool
Value
PlatForm::Boolean bool bool

true if the app terminates when the last open window is closed; false if it doesn't terminate.

Attributes

Remarks

For info about using this property, see App lifecycle.

This is a static member of the ApplicationView class. For JavaScript this means that it is a method of the ApplicationView class, not of the window object that getForCurrentView creates.

Title Title Title

Gets or sets the displayed title of the window.

public : PlatForm::String Title { get; set; }public string Title { get; set; }Public ReadWrite Property Title As string
Value
PlatForm::String string string

The title of the window.

Attributes

Remarks

The Title property provides a title for the window.

When the Title property is not set, the system shows the app's display name in the title bar, as specified in the Display name field in the app manifest (Package.appxmanifest). When you set the Title property, Windows may choose to append the app display name to the end of the Title value you set.

We recommend that you set a title that describes the window, not the app. If you have an app that can have multiple documents open, each window should have the document title, which is considered more informative than just showing the app name.

For example, assume you have an app named, "My Notes App", with a window showing a document named "Note 1". You should set the Title property to "Note 1". Windows appends the app display name so the title bar shows "Note 1 - My Notes App".

This property is a nonstatic member of the window object. For JavaScript, this means that it is a method of the window object that getForCurrentView creates, and not a method of the ApplicationView class.

TitleBar TitleBar TitleBar

Gets the title bar of the app.

public : ApplicationViewTitleBar TitleBar { get; }public ApplicationViewTitleBar TitleBar { get; }Public ReadOnly Property TitleBar As ApplicationViewTitleBar
Attributes

Value Value Value

Note

ApplicationView static methods may be altered or unavailable for releases after Windows 8.1. Instead, use ApplicationView.GetForCurrentView to get an ApplicationView object.

Gets the state of the current window (app view).

public : static ApplicationViewState Value { get; }public static ApplicationViewState Value { get; }Public Static ReadOnly Property Value As ApplicationViewState
Value
ApplicationViewState ApplicationViewState ApplicationViewState

The state of the current window (app view). This state indicates the orientation (landscape or portrait) and whether or not the app is snapped.

Attributes

Remarks

To respond to a view state change, an app queries this property from inside the app window resize event handler to determine how to lay out the app in the changed view state.

This is a static member of the ApplicationView class. For JavaScript this means that it is a method of the ApplicationView class, not of the window object that getForCurrentView creates.

ViewMode ViewMode ViewMode

Gets the app view mode for the current view.

public : ApplicationViewMode ViewMode { get; }public ApplicationViewMode ViewMode { get; }Public ReadOnly Property ViewMode As ApplicationViewMode
Value
ApplicationViewMode ApplicationViewMode ApplicationViewMode

A value of the enumeration that indicates the view mode of the current view.

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

VisibleBounds VisibleBounds VisibleBounds

Gets the visible region of the window (app view). The visible region is the region not occluded by chrome such as the status bar and app bar.

public : Rect VisibleBounds { get; }public Rect VisibleBounds { get; }Public ReadOnly Property VisibleBounds As Rect
Value
Rect Rect Rect

The visible region of the window (app view).

Attributes

Remarks

Parts of a window (app view) can be covered up (occluded) by chrome, such as the status bar and the app bar. The non-occluded region is referred to as the visible bounds. Note that, when shown, the status bar and app bar occlude the window even if their opacity is not 100%.

Methods

ExitFullScreenMode() ExitFullScreenMode() ExitFullScreenMode()

Takes the app out of full-screen mode.

public : void ExitFullScreenMode()public void ExitFullScreenMode()Public Function ExitFullScreenMode() As void
Attributes

Examples

This example shows how to toggle full-screen mode and set the PreferredLaunchWindowingMode property.

<Button x:Name="ToggleFullScreenModeButton" Content="Toggle full screen" 
        Click="ToggleFullScreenModeButton_Click">
private void ToggleFullScreenModeButton_Click(object sender, RoutedEventArgs e)
{
    var view = ApplicationView.GetForCurrentView();
    if (view.IsFullScreenMode)
    {
        view.ExitFullScreenMode();
        ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
        // The SizeChanged event will be raised when the exit from full-screen mode is complete.
    }
    else
    {
        if (view.TryEnterFullScreenMode())
        {
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
            // The SizeChanged event will be raised when the entry to full-screen mode is complete.
        }
    }
}

Remarks

To preserve full-screen mode when a user restarts the app, set PreferredLaunchWindowingMode to FullScreen if the call to TryEnterFullScreenMode returns true. When you call ExitFullScreenMode, you should set PreferredLaunchWindowingMode back to Auto or PreferredLaunchViewSize.

The system raises the CoreWindow.SizeChanged event when the view enters or exits full-screen mode. This is exposed to XAML apps as the Window.SizeChanged event and to HTML apps as the window.resize event.

See Also

GetApplicationViewIdForWindow(ICoreWindow) GetApplicationViewIdForWindow(ICoreWindow) GetApplicationViewIdForWindow(ICoreWindow)

Gets the window ID that corresponds to a specific CoreWindow managed by the app.

public : static int GetApplicationViewIdForWindow(ICoreWindow window)public static int GetApplicationViewIdForWindow(ICoreWindow window)Public Static Function GetApplicationViewIdForWindow(window As ICoreWindow) As int
Parameters
window
ICoreWindow ICoreWindow ICoreWindow

Reference to the CoreWindow object that contains a window handle used by the app.

Returns
int int int

The ID of the window associated with the supplied CoreWindow.

Attributes

Remarks

Every view has an associated CoreWindow, which handles the core UI events for the window and manages drawing operations to the window. An app can have multiple views, with separate UI threads. Use this method to determine which window is provided by a specific CoreWindow instance managed by your app.

For languages other than Javascript, this is a static member of the ApplicationView class. JavaScript does not support this method (CoreWindow is not available as an API).

GetForCurrentView() GetForCurrentView() GetForCurrentView()

Gets the view state and behavior settings of the active application.

public : static ApplicationView GetForCurrentView()public static ApplicationView GetForCurrentView()Public Static Function GetForCurrentView() As ApplicationView
Returns

An ApplicationView instance that can be used to get and set app display properties.

Attributes

Remarks

This is a static member of the ApplicationView class. For JavaScript this means that it is a method of the ApplicationView class, not of the window object that getForCurrentView creates.

IsViewModeSupported(ApplicationViewMode) IsViewModeSupported(ApplicationViewMode) IsViewModeSupported(ApplicationViewMode)

Determines whether the specified view mode is supported on the current device.

public : PlatForm::Boolean IsViewModeSupported(ApplicationViewMode viewMode)public bool IsViewModeSupported(ApplicationViewMode viewMode)Public Function IsViewModeSupported(viewMode As ApplicationViewMode) As bool
Parameters
viewMode
ApplicationViewMode ApplicationViewMode ApplicationViewMode

A value of the enumeration that indicates the desired view mode.

Returns
PlatForm::Boolean bool bool

true if the specified view mode is supported; otherwise, false.

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

SetDesiredBoundsMode(ApplicationViewBoundsMode) SetDesiredBoundsMode(ApplicationViewBoundsMode) SetDesiredBoundsMode(ApplicationViewBoundsMode)

Sets a value indicating the bounds used by the framework to lay out the contents of the window (app view).

public : PlatForm::Boolean SetDesiredBoundsMode(ApplicationViewBoundsMode boundsMode)public bool SetDesiredBoundsMode(ApplicationViewBoundsMode boundsMode)Public Function SetDesiredBoundsMode(boundsMode As ApplicationViewBoundsMode) As bool
Parameters
boundsMode
ApplicationViewBoundsMode ApplicationViewBoundsMode ApplicationViewBoundsMode

The bounds that the framework should use to lay out the contents of the window (app view).

Returns
PlatForm::Boolean bool bool

true to confirm that the change to DesiredBoundsMode was successful; otherwise, false.

Attributes

SetPreferredMinSize(Size) SetPreferredMinSize(Size) SetPreferredMinSize(Size)

Sets the smallest size, in effective pixels, allowed for the app window.

public : void SetPreferredMinSize(Size minSize)public void SetPreferredMinSize(Size minSize)Public Function SetPreferredMinSize(minSize As Size) As void
Parameters
minSize
Size Size Size

The smallest size allowed for the app window, or a Size whose height and width are both zero to use the system default minimum size.

Attributes

Remarks

To remove the preferred minimum size and use and system default minimum size instead, set the Size value to "0,0".

The smallest allowed minimum size is 192 x 48 effective pixels. The largest allowed minimum size is 500 x 500 effective pixels. If you set a value outside of these bounds, it is coerced to be within the allowed bounds. (To learn about effective pixels, see Responsive design 101 for .)

Setting the preferred minimum size affects only the view it was requested on; setting it on one view does not impact the preferred minimum size of the other views.

The preferred minimum size is not persisted after the app is closed. You should always set your preferred minimum size on your view before Window.Activate is called to present it.

If you set a preferred minimum size that is larger than the current size, the app is resized so that the preferred minimum size is honored.

See Also

ShowStandardSystemOverlays() ShowStandardSystemOverlays() ShowStandardSystemOverlays()

Shows system UI elements, like the title bar, over a full-screen app.

public : void ShowStandardSystemOverlays()public void ShowStandardSystemOverlays()Public Function ShowStandardSystemOverlays() As void
Attributes

TryConsolidateAsync() TryConsolidateAsync() TryConsolidateAsync()

Tries to close the current app view. This method is a programmatic equivalent to a user initiating a close gesture for the app view.

public : IAsyncOperation<PlatForm::Boolean> TryConsolidateAsync()public IAsyncOperation<bool> TryConsolidateAsync()Public Function TryConsolidateAsync() As IAsyncOperation( Of bool )
Returns
IAsyncOperation<PlatForm::Boolean> IAsyncOperation<bool> IAsyncOperation<bool>

true if the app views are consolidated; otherwise, false.

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

TryEnterFullScreenMode() TryEnterFullScreenMode() TryEnterFullScreenMode()

Attempts to place the app in full-screen mode.

public : PlatForm::Boolean TryEnterFullScreenMode()public bool TryEnterFullScreenMode()Public Function TryEnterFullScreenMode() As bool
Returns
PlatForm::Boolean bool bool

true if the app is placed in full-screen mode; otherwise, false.

Attributes

Examples

This example shows how to toggle full-screen mode and set the PreferredLaunchWindowingMode property.

<Button x:Name="ToggleFullScreenModeButton" Content="Toggle full screen" 
        Click="ToggleFullScreenModeButton_Click">
private void ToggleFullScreenModeButton_Click(object sender, RoutedEventArgs e)
{
    var view = ApplicationView.GetForCurrentView();
    if (view.IsFullScreenMode)
    {
        view.ExitFullScreenMode();
        ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
        // The SizeChanged event will be raised when the exit from full-screen mode is complete.
    }
    else
    {
        if (view.TryEnterFullScreenMode())
        {
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
            // The SizeChanged event will be raised when the entry to full-screen mode is complete.
        }
    }
}

Remarks

To preserve full screen mode when a user restarts the app, set PreferredLaunchWindowingMode to FullScreen if the call to TryEnterFullScreenMode returns true. When you call ExitFullScreenMode, you should set PreferredLaunchWindowingMode back to Auto or PreferredLaunchViewSize.

The system raises the CoreWindow.SizeChanged event when the view enters or exits full screen mode. This is exposed to XAML apps as the Window.SizeChanged event and to HTML apps as the window.resize event.

See Also

TryEnterViewModeAsync(ApplicationViewMode) TryEnterViewModeAsync(ApplicationViewMode) TryEnterViewModeAsync(ApplicationViewMode)

Attempts to change the app view to the specified view mode.

public : IAsyncOperation<PlatForm::Boolean> TryEnterViewModeAsync(ApplicationViewMode viewMode)public IAsyncOperation<bool> TryEnterViewModeAsync(ApplicationViewMode viewMode)Public Function TryEnterViewModeAsync(viewMode As ApplicationViewMode) As IAsyncOperation( Of bool )
Parameters
viewMode
ApplicationViewMode ApplicationViewMode ApplicationViewMode

A value of the enumeration that indicates the desired view mode.

Returns
IAsyncOperation<PlatForm::Boolean> IAsyncOperation<bool> IAsyncOperation<bool>

true if the app view was changed to the specified view mode; otherwise, false.

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

TryEnterViewModeAsync(ApplicationViewMode, ViewModePreferences) TryEnterViewModeAsync(ApplicationViewMode, ViewModePreferences) TryEnterViewModeAsync(ApplicationViewMode, ViewModePreferences)

Attempts to change the app view to the specified view mode using the specified options.

public : IAsyncOperation<PlatForm::Boolean> TryEnterViewModeAsync(ApplicationViewMode viewMode, ViewModePreferences viewModePreferences)public IAsyncOperation<bool> TryEnterViewModeAsync(ApplicationViewMode viewMode, ViewModePreferences viewModePreferences)Public Function TryEnterViewModeAsync(viewMode As ApplicationViewMode, viewModePreferences As ViewModePreferences) As IAsyncOperation( Of bool )
Parameters
viewMode
ApplicationViewMode ApplicationViewMode ApplicationViewMode

A value of the enumeration that indicates the desired view mode.

viewModePreferences
ViewModePreferences ViewModePreferences ViewModePreferences

Preferred settings for the desired view mode.

Returns
IAsyncOperation<PlatForm::Boolean> IAsyncOperation<bool> IAsyncOperation<bool>

true if the app view was changed to the specified view mode; otherwise, false.

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

Remarks

The view mode preferences are requested values only. The system might override these values when your app is changed to the new view mode.

TryResizeView(Size) TryResizeView(Size) TryResizeView(Size)

Attempts to change the size of the view to the specified size in effective pixels.

public : PlatForm::Boolean TryResizeView(Size value)public bool TryResizeView(Size value)Public Function TryResizeView(value As Size) As bool
Parameters
value
Size Size Size

The new size of the view in effective pixels.

Returns
PlatForm::Boolean bool bool

true if the view is resized to the requested size; otherwise, false.

Attributes

Remarks

A resize request affects only the view it was requested on. Resizing one view does not affect the size of any other views.

Even when this method returns false, the user can manually resize the view and cause a SizeChanged event to occur.

If the resize forces parts of the app to go outside of available work area, the system will move it back into the available work area.

The resize request has no effect and the method returns false in these cases:

  • The requested size is larger than the available work area.
  • The requested size is less than the view's minimum size. (See SetPreferredMinSize.)
  • This method is called while in while the app is running in Tablet Mode.

We recommend that you not begin any layout work until the window's SizeChanged event occurs. This avoids two different layout passes (one that happens immediately after TryResizeView and then another when the SizeChanged event occurs).

See Also

TryUnsnap() TryUnsnap() TryUnsnap()

Note

TryUnsnap may be altered or unavailable for releases after Windows 8.1. Apps can be continuously resized, but cannot be snapped, starting in Windows 8.1. Also, ApplicationView static methods may be altered or unavailable for releases after Windows 8.1. Use ApplicationView.GetForCurrentView to get an ApplicationView object.

Attempts to unsnap a previously snapped app. This call will only succeed when the app is running in the foreground.

public : static PlatForm::Boolean TryUnsnap()public static bool TryUnsnap()Public Static Function TryUnsnap() As bool
Returns
PlatForm::Boolean bool bool

true if the app has been successfully unsnapped; false if the unsnap attempt failed.

Attributes

Remarks

This is a static member of the ApplicationView class. For JavaScript this means that it is a method of the ApplicationView class, not of the window object that getForCurrentView creates.

See Also

TryUnsnapToFullscreen() TryUnsnapToFullscreen() TryUnsnapToFullscreen()

Attempts to unsnap a previously snapped app.

public : static PlatForm::Boolean TryUnsnapToFullscreen()public static bool TryUnsnapToFullscreen()Public Static Function TryUnsnapToFullscreen() As bool
Returns
PlatForm::Boolean bool bool

true if the app has been successfully unsnapped; false if the unsnap attempt failed.

Attributes

Events

Consolidated Consolidated Consolidated

Occurs when the window is removed from the list of recently used apps, or if the user executes a close gesture on it.

public : event TypedEventHandler Consolidatedpublic event TypedEventHandler ConsolidatedPublic Event Consolidated
Attributes

VisibleBoundsChanged VisibleBoundsChanged VisibleBoundsChanged

This event is raised when the value of VisibleBounds changes, typically as a result of the status bar, app bar, or other chrome being shown or hidden.

public : event TypedEventHandler VisibleBoundsChangedpublic event TypedEventHandler VisibleBoundsChangedPublic Event VisibleBoundsChanged
Attributes

See Also