Skip to main content

Windows Dev Center

ResourceLoader.GetForCurrentView() | getForCurrentView() method

Gets a ResourceLoader object for the Resources subtree of the currently running app's main ResourceMap. This ResourceLoader uses a default context associated with the current view.

Syntax


var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.getForCurrentView();

public static ResourceLoader GetForCurrentView()

Public Shared Function GetForCurrentView() As ResourceLoader

public:
static ResourceLoader^ GetForCurrentView()

Parameters

This method has no parameters.

Return value

Type: ResourceLoader

A resource loader for the Resources subtree of the currently running app's main ResourceMap.

Remarks

This method allows access relative to a resource file named "resources" (resources.resjson or resources.resw). The ResourceLoader that is returned uses a default context associated with the current view.

The resource management system for Windows Store apps supports the tailoring of resources for scale. Starting in Windows 8.1, different views owned by an app are able to display simultaneously on different display devices that may use different scales. In this way, scale is a per-view characteristic.

A ResourceLoader has an implicit context that is used when ResourceLoader methods are used to retrieve a resource. Since a ResourceLoader has an implicit context, and since the scale qualifier of contexts is dependent on an associated view, a ResourceLoader must be associated with a particular view.

Errors

This method fails with an exception if it is called in a windowless thread, or if the main ResourceMap does not have a "resources" subtree.

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.ApplicationModel.Resources
Windows::ApplicationModel::Resources [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.ApplicationModel.Resources
Windows::ApplicationModel::Resources [C++]

Metadata

Windows.winmd

See also

ResourceLoader
GetForCurrentView(String)