Udostępnij za pośrednictwem


ResourceMap.GetValue Method

Definition

Overloads

GetValue(String)

Note

GetValue(String) may be altered or unavailable for releases after Windows 8.1. Instead, use GetValue(String, ResourceContext).

Returns the most appropriate candidate for a resource that is specified by a resource identifier within the default context.

GetValue(String, ResourceContext)

Returns the most appropriate candidate for a resource that is specified by a resource identifier for the supplied context.

GetValue(String)

Note

GetValue(String) may be altered or unavailable for releases after Windows 8.1. Instead, use GetValue(String, ResourceContext).

Returns the most appropriate candidate for a resource that is specified by a resource identifier within the default context.

public:
 virtual ResourceCandidate ^ GetValue(Platform::String ^ resource) = GetValue;
/// [Windows.Foundation.Metadata.Deprecated("GetValue(string) may be altered or unavailable for releases after Windows 8.1. Instead, use GetValue(string, ResourceContext).", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Overload("GetValue")]
ResourceCandidate GetValue(winrt::hstring const& resource);
/// [Windows.Foundation.Metadata.Overload("GetValue")]
/// [Windows.Foundation.Metadata.Deprecated("GetValue(string) may be altered or unavailable for releases after Windows 8.1. Instead, use GetValue(string, ResourceContext).", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
ResourceCandidate GetValue(winrt::hstring const& resource);
/// [Windows.Foundation.Metadata.Overload("GetValue")]
ResourceCandidate GetValue(winrt::hstring const& resource);
[Windows.Foundation.Metadata.Deprecated("GetValue(string) may be altered or unavailable for releases after Windows 8.1. Instead, use GetValue(string, ResourceContext).", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Overload("GetValue")]
public ResourceCandidate GetValue(string resource);
[Windows.Foundation.Metadata.Overload("GetValue")]
[Windows.Foundation.Metadata.Deprecated("GetValue(string) may be altered or unavailable for releases after Windows 8.1. Instead, use GetValue(string, ResourceContext).", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
public ResourceCandidate GetValue(string resource);
[Windows.Foundation.Metadata.Overload("GetValue")]
public ResourceCandidate GetValue(string resource);
function getValue(resource)
Public Function GetValue (resource As String) As ResourceCandidate

Parameters

resource
String

Platform::String

winrt::hstring

A resource identifier specified as a name or reference. For details, see the remarks for ResourceMap class.

Returns

A ResourceCandidate that describes the most appropriate candidate.

Attributes

See also

Applies to

GetValue(String, ResourceContext)

Returns the most appropriate candidate for a resource that is specified by a resource identifier for the supplied context.

public:
 virtual ResourceCandidate ^ GetValue(Platform::String ^ resource, ResourceContext ^ context) = GetValue;
/// [Windows.Foundation.Metadata.Overload("GetValueForContext")]
ResourceCandidate GetValue(winrt::hstring const& resource, ResourceContext const& context);
[Windows.Foundation.Metadata.Overload("GetValueForContext")]
public ResourceCandidate GetValue(string resource, ResourceContext context);
function getValue(resource, context)
Public Function GetValue (resource As String, context As ResourceContext) As ResourceCandidate

Parameters

resource
String

Platform::String

winrt::hstring

A resource specified as a name or reference. For details, see the remarks for ResourceMap class.

context
ResourceContext

The context for which to select the most appropriate candidate.

Returns

A ResourceCandidate that describes the most appropriate candidate.

Attributes

Remarks

Some resources are loaded according to the scale of the view where they will be displayed, and different views within an app might be displayed on different devices with different scales. Scale is a per-view characteristic.

Since the GetValue method selects the best candidate for the specified resource in relation to a runtime context, and since the scale qualifier of a ResourceContext depends on the associated view, GetValue should always be called with a ResourceContext object obtained from the view in which the resource will be used. Call ResourceContext.GetForCurrentView to retrieve the appropriate ResourceContext.

See also

Applies to