Class ResourceDictionary

Class Hierarchy

A resource dictionary is a container that maps resource IDs to resources. A node can refer to resources by setting resource IDs to resource ID properties. You can set a resource dictionary to the node or to any of its parent nodes to define which resources the node uses. You can use a resource dictionary to group similar resources to logical entity, such as themes or locales, and change a resource dictionary of a node to change multiple resources at the same time.

Use Node::acquireResource to get the resource from the resource dictionary of a node or from the resource dictionaries of its parent nodes.

A resource dictionary can map resource IDs to resources in these ways:

  • Directly to a resource pointer
  • Indirectly to a resource with a resource URL

Use acquire and tryAcquire functions to get a mapped resource regardless of the way how a resource ID is mapped to a resource.

You can store nested resource dictionaries in a resource dictionary. When you are getting a resource from a resource dictionary and the resource dictionary cannot find the resource ID you specify, the resource dictionary looks for the resource ID recursively in the nested resource dictionaries.

In a resource dictionary you can store resources without mapping a resource ID to them. In Kanzi Engine such resources are called anonymous resources. You can get anonymous resources with beginAnonymousResources and endAnonymousResources.

Inherits properties and message types from ResourceDictionaryMetadata.

Synopsis

Methods
create()

Creates a resource dictionary

ResourceDictionary.ResourceDictionary:create(name)

Creates a resource dictionary.

Parameters
name (string)

The name of the resource dictionary.

Return Values
(ResourceDictionary)

The pointer to the resource dictionary.