Udostępnij za pośrednictwem


ResourceMap.GetValue Method

Definition

Overloads

GetValue(String)

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)

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.Overload("GetValue")]
ResourceCandidate GetValue(winrt::hstring const& 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

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("GetValueWithContext")]
ResourceCandidate GetValue(winrt::hstring const& resource, ResourceContext const& context);
[Windows.Foundation.Metadata.Overload("GetValueWithContext")]
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.

Applies to