次の方法で共有


XRXamlSource (Windows Embedded CE 6.0)

1/6/2010

This structure contains a pointer to a source of XAML markup.

Syntax

struct XRXamlSource {
  enum SourceType {
        XRS_STRING = 0,
        XRS_FILENAME,
        XRS_RESOURCE,
        XRS_STREAM
  };
  SourceType  Type;  
  union{
    const WCHAR *pStr; 
    IStream     *pStream;
    struct tagResouce {
      HMODULE      hMod;
      const WCHAR *pResType;
      const WCHAR *pResID;
    } Resource;
  } Value;

  Void SetFile(const WCHAR *psz) {
    Type = XRS_FILENAME; Value.pStr = psz;
  }
  void SetString(const WCHAR *psz) {
    Type = XRS_STRING; Value.pStr = psz;
  }
  void SetResource(HMODULE h, const WCHAR *pType, const WCHAR *pID) {
    Type = XRS_RESOURCE;
    Value.Resource.hMod = h;
    Value.Resource.pResType = pType;
    Value.Resource.pResID = pID;
  }
  void SetStream(IStream* p) {
    Type = XRS_STREAM; Value.pStream = p; 
  }
};

Members

  • Type
    Describes the source type of the XAML markup. It can be one of the following:

    • XRS_STRING
      A string referenced in Value.pStr
    • XRS_FILENAME
      A file referenced in Value.pStr
    • XRS_RESOURCE
      A resource with a resource ID referenced in Value.Resource
    • XRS_STREAM
      A data stream referenced in Value. pStream
  • Value.pStr
    Points to a null-terminated character string that contains either the XAML markup or the path of the file name that contains the XAML markup.
  • Value.pStream
    Points to an IStream interface that provides access to a stream object that contains XAML markup.
  • Value.Resource
    Identifies a resource that contains the XAML markup. Resource contains the following members:

    • hMod
      Handle to the application instance.
    • pResType
      Points to a string that describes the resource type, such as L"XAML".
    • pResID
      Points to a string that contains the resource ID.
  • SetFile
    Member function that sets the path of the source file that contains the XAML markup.

    The input parameter of this function is a pointer to a null-terminated string with the .xaml extension. You must specify the file name as a local path in local storage and not on a remote server or Web site.

    This function sets Type to XRS_FILENAME.

  • SetString
    Member function that sets the value of the source string that contains the XAML markup.

    You must set the input parameter of this method as a pointer to a null-terminated string.

    This function sets Type to XRS_STRING.

  • SetResource
    Member function that sets the value of the resource that contains the XAML markup.

    This function has the following input parameters:

    • h
      Handle to the application instance.
    • pResType
      Points to a string that describes the resource type, such as L"XAML".
    • pID
      Points to a string that contains the ID of the resource. If you have an integer value, you can convert it to a resource type by using the MAKEINTRESOURCE macro.

    You must provide values for all three parameters. The function stores these values inside Value.Resource.

    This function sets Type to XRS_RESOURCE.

  • SetStream
    Member function that sets the pStream pointer to the stream source that contains the XAML markup.

    The input parameter is a pointer to an IStream interface that provides access to the stream object.

    This function sets Type to XRS_STREAM.

Remarks

You are responsible for managing the lifetime of the data that the structure members reference and for making sure that the data is available when the application uses the structure as a XAML source. This structure is a parameter in the IXRApplication::CreateHostFromXaml, IXRApplication::ParseXaml, and IXRApplication::ParseXamlWithExistingRoot methods.

Requirements

Header XamlRuntime.h
sysgen SYSGEN_XAML_RUNTIME
Windows Embedded CE Windows Embedded CE 6.0 R3

See Also

Reference

Silverlight for Windows Embedded Structures