Resource​Qualifier Resource​Qualifier Resource​Qualifier Class


Defines the qualifiers associated with a ResourceCandidate.

public sealed class ResourceQualifier : IResourceQualifierpublic sealed class ResourceQualifier : IResourceQualifierPublic NotInheritable Class ResourceQualifier Implements IResourceQualifier
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

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

public PlatForm::Boolean IsDefault { get; }public bool IsDefault { get; }Public ReadOnly Property IsDefault As bool
bool bool bool

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


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; }public bool IsMatch { get; }Public ReadOnly Property IsMatch As bool
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

The name of the qualifier.

public PlatForm::String QualifierName { get; }public string QualifierName { get; }Public ReadOnly Property QualifierName As string
string string string

The name of the qualifier.


QualifierValue QualifierValue QualifierValue

The value of the qualifier.

public PlatForm::String QualifierValue { get; }public string QualifierValue { get; }Public ReadOnly Property QualifierValue As string
string string string

The value of the qualifier.


Score Score Score

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

public double Score { get; }public double Score { get; }Public ReadOnly Property Score As double
double double double

A score in the range 0.0– 1.0.


See Also