ResourceQualifier ResourceQualifier ResourceQualifier ResourceQualifier ResourceQualifier Class


Defines the qualifiers associated with a ResourceCandidate.

public : sealed class ResourceQualifier : IResourceQualifier
struct winrt::Windows::ApplicationModel::Resources::Core::ResourceQualifier : IResourceQualifier
public sealed class ResourceQualifier : IResourceQualifier
Public NotInheritable Class ResourceQualifier Implements IResourceQualifier
// This class does not provide a public constructor.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


This example is based on scenario 13 of the Application resources and localization sample. See the sample for the more complete solution.

// Create a ResourceContext.
var resourceContext = new Windows.ApplicationModel.Resources.Core.ResourceContext();

// Set the specific context for lookup of resources.
var qualifierValues = resourceContext.qualifierValues;
qualifierValues["language"] = "en-US";
qualifierValues["contrast"] = "standard";
qualifierValues["scale"] = "140";
qualifierValues["homeregion"] = "021"; // Northern America

// Resources actually reside within Scenario13 Resource Map.
var resourceIds = [

var output = { str: "" };
resourceIds.forEach(function (resourceId) {
    renderNamedResource(resourceId, resourceContext, output);

function renderNamedResource(resourceId, resourceContext, output) {
    output.str += "Resource ID " + resourceId + ":\n";
    // Lookup the resource in the mainResourceMap (the one for this package).
    var namedResource = Windows.ApplicationModel.Resources.Core.ResourceManager.current.mainResourceMap.lookup(resourceId);

    // Return a ResourceCandidateVectorView of all possible resources candidates
    // resolved against the context in order of appropriateness.
    var resourceCandidates = namedResource.resolveAll(resourceContext);

    resourceCandidates.forEach(function (candidate, index) {
        renderCandidate(candidate, index, output);
    output.str += "\n";

function renderCandidate(candidate, index, output) {
    // Get all the various qualifiers for the candidate (such as language, scale, contrast).
    candidate.qualifiers.forEach(function (qualifier) {
        output.str += "qualifierName: " + qualifier.qualifierName + "\n";
        output.str += "qualifierValue: " + qualifier.qualifierValue + "\n";
        output.str += "isDefault: ";
        output.str += (qualifier.isDefault) ? "true\n" : "false\n";
        output.str += "isMatch: ";
        output.str += (qualifier.isMatch) ? "true\n" : "false\n";
        output.str += "score: " + qualifier.score + "\n";
        output.str += "\n";


IsDefault IsDefault IsDefault IsDefault IsDefault

Indicates whether this qualifier should be considered as a default match when no match is found.

public : Platform::Boolean IsDefault { get; }
bool IsDefault();
public bool IsDefault { get; }
Public ReadOnly Property IsDefault As bool
var bool = resourceQualifier.isDefault;
bool bool bool

TRUE if this candidate can be used as a default fallback value for any context; otherwise, FALSE.

IsMatch IsMatch IsMatch IsMatch IsMatch

Indicates whether a given qualifier for a given candidate matched the context when a named resource is resolved to a candidate for some given context.

public : Platform::Boolean IsMatch { get; }
bool IsMatch();
public bool IsMatch { get; }
Public ReadOnly Property IsMatch As bool
var bool = resourceQualifier.isMatch;
bool bool bool

TRUE if this qualifier matched the environment against which it was evaluated; otherwise, FALSE.


If a ResourceQualifier is obtained in a scenario that does not involve resolving a named resource for some context, the value is FALSE. (For example, when all candidates are enumerated for a named resource and their qualifiers are inspected.)

After resolving a named resource for some context, IsMatch is TRUE if the qualifier matches the context on a non-default basis (that is, the qualifier value is not designated as the default value for that qualifier). The score is non-zero, and IsDefault is FALSE.

After resolving a named resource for some context, IsMatch is FALSE if the qualifier does not match the context on a non-default basis. (The qualifier value may or may not be the default value for that qualifier. The score may or may not be zero, according to whether the qualifier is the default value.)

QualifierName QualifierName QualifierName QualifierName QualifierName

The name of the qualifier.

public : Platform::String QualifierName { get; }
winrt::hstring QualifierName();
public string QualifierName { get; }
Public ReadOnly Property QualifierName As string
var string = resourceQualifier.qualifierName;
string string string

The name of the qualifier.

QualifierValue QualifierValue QualifierValue QualifierValue QualifierValue

The value of the qualifier.

public : Platform::String QualifierValue { get; }
winrt::hstring QualifierValue();
public string QualifierValue { get; }
Public ReadOnly Property QualifierValue As string
var string = resourceQualifier.qualifierValue;
string string string

The value of the qualifier.

Score Score Score Score Score

A score that indicates how well the qualifier matched the context against which it was resolved.

public : double Score { get; }
double Score();
public double Score { get; }
Public ReadOnly Property Score As double
var double = resourceQualifier.score;
double double double

A score in the range 0.0– 1.0.

See Also