ResourceLoader Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides simplified access to app resources such as app UI strings.
public ref class ResourceLoader sealed
/// [Windows.Foundation.Metadata.Activatable(65536, "Microsoft.ApplicationModel.Resources.MrtContract")]
/// [Windows.Foundation.Metadata.Activatable(Microsoft.ApplicationModel.Resources.IResourceLoaderFactory, 65536, "Microsoft.ApplicationModel.Resources.MrtContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.ApplicationModel.Resources.MrtContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ResourceLoader final
[Windows.Foundation.Metadata.Activatable(65536, "Microsoft.ApplicationModel.Resources.MrtContract")]
[Windows.Foundation.Metadata.Activatable(typeof(Microsoft.ApplicationModel.Resources.IResourceLoaderFactory), 65536, "Microsoft.ApplicationModel.Resources.MrtContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.ApplicationModel.Resources.MrtContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ResourceLoader
function ResourceLoader(fileName, resourceMap)
Public NotInheritable Class ResourceLoader
- Inheritance
- Attributes
Remarks
A ResourceLoader object encapsulates a particular ResourceMap and a ResourceContext, combined in a simple API.
A specific resource map can be specified when the ResourceLoader is obtained; if no resource map is specified, the ResourceLoader will provide access to the "Resources" subtree of the app's main resource map.
In general, resources can be sensitive to scale or other display characteristics. For that reason, resource contexts are generally associated with a specific view. Since a ResourceLoader encapsulates a resource context, this also applies to a ResourceLoader.
- Obtain the scale factor for the current view by using the DisplayInformation class instead of the deprecated DisplayProperties class.
- Apps that set explicit width and height of elements should still work fine, other than possibly displaying blurry images.
Also see Screen sizes and breakpoints.
Constructors
ResourceLoader() |
Constructs a new ResourceLoader object for the "Resources" subtree of the currently running app's main ResourceMap. |
ResourceLoader(String, String) |
Creates a ResourceLoader for the given context and map. |
ResourceLoader(String) |
Constructs a new ResourceLoader object for the specified ResourceMap. |
Methods
GetDefaultResourceFilePath() |
Gets the default resource file path, which is the path a ResourceLoader will be created with if no custom path is specified. |
GetString(String) |
Returns the most appropriate string value of a resource, specified by resource identifier. |
GetStringForUri(Uri) |
Returns the most appropriate string value of a resource, specified by a Uniform Resource Identifier (URI) resource identifier, for the default ResourceContext of the currently running app. |