ApplicationView ApplicationView ApplicationView ApplicationView Class

Represents the active application view and associated states and behaviors.

Syntax

Declaration

public sealed class ApplicationViewpublic sealed class ApplicationViewPublic NotInheritable Class ApplicationViewpublic sealed class ApplicationView

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 GetForCurrentView().

Note

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

Properties summary

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

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

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

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

Gets the ID of the window (app view).

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.

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

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

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

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

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

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

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.

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

Gets or sets the displayed title of the window.

Gets the title bar of the app.

Note

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

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

Prerelease. Gets the app view mode for the current view.

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.

Methods summary

Takes the app out of full-screen mode.

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

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

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

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

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

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

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

Attempts to place the app in full-screen mode.

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

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

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

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 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.

Attempts to unsnap a previously snapped app.

Events summary

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

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.

Properties

  • AdjacentToLeftDisplayEdge
    AdjacentToLeftDisplayEdge
    AdjacentToLeftDisplayEdge
    AdjacentToLeftDisplayEdge

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

    public bool AdjacentToLeftDisplayEdge { get; }public bool AdjacentToLeftDisplayEdge { get; }Public ReadOnly Property AdjacentToLeftDisplayEdge As boolpublic bool AdjacentToLeftDisplayEdge { get; }

    Property Value

    • bool
      bool
      bool
      bool

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

    Remarks

    The system raises the SizeChanged event when the value of this property changes. This is exposed to XAML apps as the 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
    AdjacentToRightDisplayEdge

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

    public bool AdjacentToRightDisplayEdge { get; }public bool AdjacentToRightDisplayEdge { get; }Public ReadOnly Property AdjacentToRightDisplayEdge As boolpublic bool AdjacentToRightDisplayEdge { get; }

    Property Value

    • bool
      bool
      bool
      bool

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

    Remarks

    The system raises the SizeChanged event when the value of this property changes. This is exposed to XAML apps as the 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
    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 ApplicationViewBoundsModepublic ApplicationViewBoundsMode DesiredBoundsMode { get; }

    Property Value

  • FullScreenSystemOverlayMode
    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 FullScreenSystemOverlayModepublic FullScreenSystemOverlayMode FullScreenSystemOverlayMode { get; set; }

    Property Value

  • Id
    Id
    Id
    Id

    Gets the ID of the window (app view).

    public int Id { get; }public int Id { get; }Public ReadOnly Property Id As intpublic int Id { get; }

    Property Value

    • int
      int
      int
      int

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

    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
    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 bool IsFullScreen { get; }public bool IsFullScreen { get; }Public ReadOnly Property IsFullScreen As boolpublic bool IsFullScreen { get; }

    Property Value

    • bool
      bool
      bool
      bool

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

    Remarks

    The system raises the SizeChanged event when the value of this property changes. This is exposed to XAML apps as the 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
    IsFullScreenMode

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

    public bool IsFullScreenMode { get; }public bool IsFullScreenMode { get; }Public ReadOnly Property IsFullScreenMode As boolpublic bool IsFullScreenMode { get; }

    Property Value

    • bool
      bool
      bool
      bool

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

    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 SizeChanged event when the value of this property changes. This is exposed to XAML apps as the 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 IsFullWindow property instead.

  • IsOnLockScreen
    IsOnLockScreen
    IsOnLockScreen
    IsOnLockScreen

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

    public bool IsOnLockScreen { get; }public bool IsOnLockScreen { get; }Public ReadOnly Property IsOnLockScreen As boolpublic bool IsOnLockScreen { get; }

    Property Value

    • bool
      bool
      bool
      bool

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

    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
    IsScreenCaptureEnabled

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

    public bool IsScreenCaptureEnabled { get; set; }public bool IsScreenCaptureEnabled { get; set; }Public ReadWrite Property IsScreenCaptureEnabled As boolpublic bool IsScreenCaptureEnabled { get; set; }

    Property Value

    • bool
      bool
      bool
      bool

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

    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.

  • Orientation
    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 ApplicationViewOrientationpublic ApplicationViewOrientation Orientation { get; }

    Property Value

    Remarks

    For an example of using the IsScreenCaptureEnabled 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
    PreferredLaunchViewSize

    Gets or sets the size that the app launches with when the 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 Sizepublic static Size PreferredLaunchViewSize { get; set; }

    Property Value

    Remarks

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

  • PreferredLaunchWindowingMode
    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 ApplicationViewWindowingModepublic static ApplicationViewWindowingMode PreferredLaunchWindowingMode { get; set; }

    Property Value

    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.

    • PreferredLaunchViewSize: When launched, the window is sized as specified by the PreferredLaunchViewSize property.
    • FullScreen: The window is launched in full-screen mode. (Full-screen mode in not the same as maximized. See IsFullScreenMode for more info.)

    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 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.

    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.
            }
        }
    }
    
  • SuppressSystemOverlays
    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 bool SuppressSystemOverlays { get; set; }public bool SuppressSystemOverlays { get; set; }Public ReadWrite Property SuppressSystemOverlays As boolpublic bool SuppressSystemOverlays { get; set; }

    Property Value

    • bool
      bool
      bool
      bool

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

    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
    TerminateAppOnFinalViewClose

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

    public static bool TerminateAppOnFinalViewClose { get; set; }public static bool TerminateAppOnFinalViewClose { get; set; }Public Static ReadWrite Property TerminateAppOnFinalViewClose As boolpublic static bool TerminateAppOnFinalViewClose { get; set; }

    Property Value

    • bool
      bool
      bool
      bool

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

    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
    Title

    Gets or sets the displayed title of the window.

    public string Title { get; set; }public string Title { get; set; }Public ReadWrite Property Title As stringpublic string Title { get; set; }

    Property Value

    • string
      string
      string
      string

      The title of the window.

    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
    TitleBar

    Gets the title bar of the app.

    public ApplicationViewTitleBar TitleBar { get; }public ApplicationViewTitleBar TitleBar { get; }Public ReadOnly Property TitleBar As ApplicationViewTitleBarpublic ApplicationViewTitleBar TitleBar { get; }

    Property Value

  • Value
    Value
    Value
    Value
    Note

    ApplicationView static methods may be altered or unavailable for releases after Windows 8.1. Instead, use 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 ApplicationViewStatepublic static ApplicationViewState Value { get; }

    Property Value

    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
    ViewMode

    Prerelease. Gets the app view mode for the current view.

    public ApplicationViewMode ViewMode { get; }public ApplicationViewMode ViewMode { get; }Public ReadOnly Property ViewMode As ApplicationViewModepublic ApplicationViewMode ViewMode { get; }

    Property Value

  • VisibleBounds
    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 Rectpublic Rect VisibleBounds { get; }

    Property Value

    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()
    ExitFullScreenMode()

    Takes the app out of full-screen mode.

    public void ExitFullScreenMode()public void ExitFullScreenMode()Public Function ExitFullScreenMode() As voidpublic void ExitFullScreenMode()

    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 SizeChanged event when the view enters or exits full-screen mode. This is exposed to XAML apps as the SizeChanged event and to HTML apps as the window.resize event.

    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.
            }
        }
    }
    
  • GetApplicationViewIdForWindow(ICoreWindow)
    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 intpublic static int GetApplicationViewIdForWindow(ICoreWindow window)

    Parameters

    Returns

    • int
      int
      int
      int

      The ID of the window associated with the supplied CoreWindow.

    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()
    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 ApplicationViewpublic static ApplicationView GetForCurrentView()

    Returns

    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)
    IsViewModeSupported(ApplicationViewMode)

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

    public bool IsViewModeSupported(ApplicationViewMode viewMode)public bool IsViewModeSupported(ApplicationViewMode viewMode)Public Function IsViewModeSupported(viewMode As ApplicationViewMode) As boolpublic bool IsViewModeSupported(ApplicationViewMode viewMode)

    Parameters

    Returns

    • bool
      bool
      bool
      bool

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

  • SetDesiredBoundsMode(ApplicationViewBoundsMode)
    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 bool SetDesiredBoundsMode(ApplicationViewBoundsMode boundsMode)public bool SetDesiredBoundsMode(ApplicationViewBoundsMode boundsMode)Public Function SetDesiredBoundsMode(boundsMode As ApplicationViewBoundsMode) As boolpublic bool SetDesiredBoundsMode(ApplicationViewBoundsMode boundsMode)

    Parameters

    Returns

    • bool
      bool
      bool
      bool

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

  • SetPreferredMinSize(Size)
    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 voidpublic void SetPreferredMinSize(Size minSize)

    Parameters

    • minSize

      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.

    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 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.

  • ShowStandardSystemOverlays()
    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 voidpublic void ShowStandardSystemOverlays()
  • TryConsolidateAsync()
    TryConsolidateAsync()
    TryConsolidateAsync()
    TryConsolidateAsync()

    Prerelease. 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<bool> TryConsolidateAsync()public IAsyncOperation<bool> TryConsolidateAsync()Public Function TryConsolidateAsync() As IAsyncOperation( Of bool )public IAsyncOperation<bool> TryConsolidateAsync()

    Returns

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

  • TryEnterFullScreenMode()
    TryEnterFullScreenMode()
    TryEnterFullScreenMode()
    TryEnterFullScreenMode()

    Attempts to place the app in full-screen mode.

    public bool TryEnterFullScreenMode()public bool TryEnterFullScreenMode()Public Function TryEnterFullScreenMode() As boolpublic bool TryEnterFullScreenMode()

    Returns

    • bool
      bool
      bool
      bool

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

    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 SizeChanged event when the view enters or exits full screen mode. This is exposed to XAML apps as the SizeChanged event and to HTML apps as the window.resize event.

    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.
            }
        }
    }
    
  • TryEnterViewModeAsync(ApplicationViewMode)
    TryEnterViewModeAsync(ApplicationViewMode)
    TryEnterViewModeAsync(ApplicationViewMode)
    TryEnterViewModeAsync(ApplicationViewMode)

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

    public IAsyncOperation<bool> TryEnterViewModeAsync(ApplicationViewMode viewMode)public IAsyncOperation<bool> TryEnterViewModeAsync(ApplicationViewMode viewMode)Public Function TryEnterViewModeAsync(viewMode As ApplicationViewMode) As IAsyncOperation( Of bool )public IAsyncOperation<bool> TryEnterViewModeAsync(ApplicationViewMode viewMode)

    Parameters

    Returns

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

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

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

    public IAsyncOperation<bool> 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 )public IAsyncOperation<bool> TryEnterViewModeAsync(ApplicationViewMode viewMode, ViewModePreferences viewModePreferences)

    Parameters

    Returns

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

    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)
    TryResizeView(Size)

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

    public bool TryResizeView(Size value)public bool TryResizeView(Size value)Public Function TryResizeView(value As Size) As boolpublic bool TryResizeView(Size value)

    Parameters

    Returns

    • bool
      bool
      bool
      bool

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

    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 @Windows.UI.ViewManagement.ApplicationView.SetPreferredMinSize(Windows.Foundation.Size).)
    • 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(Size) and then another when the SizeChanged event occurs).

  • TryUnsnap()
    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 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 bool TryUnsnap()public static bool TryUnsnap()Public Static Function TryUnsnap() As boolpublic static bool TryUnsnap()

    Returns

    • bool
      bool
      bool
      bool

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

    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.

  • TryUnsnapToFullscreen()
    TryUnsnapToFullscreen()
    TryUnsnapToFullscreen()
    TryUnsnapToFullscreen()

    Attempts to unsnap a previously snapped app.

    public static bool TryUnsnapToFullscreen()public static bool TryUnsnapToFullscreen()Public Static Function TryUnsnapToFullscreen() As boolpublic static bool TryUnsnapToFullscreen()

    Returns

    • bool
      bool
      bool
      bool

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

Events

  • Consolidated
    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 Consolidatedpublic event TypedEventHandler Consolidated
  • VisibleBoundsChanged
    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 VisibleBoundsChangedpublic event TypedEventHandler VisibleBoundsChanged

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.MuseAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.UI.ViewManagement.dll