Working with Resource Groups

A resource group is a set of resources (images and sounds) for a UI. By creating a resource group for a UI, you can preload the items for the UI before the page is displayed or rendered.

To create a resource group:

  • Set the items in the resource group within the Locals section of a UI using the ResourceGroup.Resources property. For example:

        <Locals>
          <ResourceGroup Name="Resources">
            <Resources>
              <Sound Name="MySound" Source="http://www.website.com/soundfile.wav" />
             <Image Name="MyImage" Source="http://www.website.com/imagefile.jpg" />
            </Resources>
          </ResourceGroup>
        </Locals>
    
  • Use the Acquire method in the Rules section to load the items from the resource group. For example:

          <Rule>
            <Actions>
              <Invoke Target="[Resources.Acquire]" />
            </Actions>
          </Rule>
    
  • To get progress information, use the AcquisitionStatus property. This status applies to the group as a whole—the status does not reach "Done" until every item in the group has been loaded.

          <Rule>
            <Conditions>
              <Equality Source="[Resources.AcquisitionStatus]"
                        Value="Done" />
            </Conditions>
            <Actions>
                ...
            </Actions>
          </Rule>
    
  • To refer to an item in the resource group, such as to display or play it, use the following format:

      ResourceGroupName.#ResourceName!ResourceType
    

    ResourceType can be "Image" or "Sound".

    For example:

          <Rule>
            <Conditions>
                ...
            </Conditions>
            <Actions>
              <PlaySound Sound="[Resources.#MySound!Sound]" />
            </Actions>
          </Rule>
    

Sample Explorer

  • Markup > Resource Group

See Also