Partager via


PFN_CREATE_CONTROL (Windows Embedded CE 6.0)

1/6/2010

This callback function is defined by the application. Silverlight for Windows Embedded calls this function to resolve a reference to an unknown XAML element name by creating a control. The PFN_CREATE_CONTROL name is a placeholder for the function name that the application defines.

Syntax

typedef HRESULT (CALLBACK *PFN_CREATE_CONTROL)(
    IXRDependencyObject *pExistingAXDO,
    IXRDependencyObject** pNewAXDO
);

Parameters

  • pExistingAXDO
    [in] Points to an IXRDependencyObject that is the existing base dependency object.
  • pNewAXDO
    [out] Address of a pointer to an IXRDependencyObject that represents the new custom control.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

This callback function is an input parameter to IXRApplication::RegisterControl. To fill this parameter, you must first implement a callback function that matches the function signature provided in the syntax section and then pass the name of your callback function into RegisterControl.

Example

The following example code shows an example implementation of an application-defined callback function.

Important

For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.

#include "XamlRuntime.h"

HRESULT CreateBaseScreen(__in IXRDependencyObject* pExistingDependencyObject, __out IXRDependencyObject **ppNewDp)
{
    HRESULT hr = E_FAIL;
    XRXamlSource Source;

    Source.SetResource(g_hInstance, ResType[RT_XAML], MAKEINTRESOURCE(ID_XAML_BASE_SCREEN));

    hr = g_pApplication->ParseXamlWithExistingRoot(&Source, pExistingDependencyObject);
 
    *ppNewDp  = pExistingDependencyObject;
    pExistingDependencyObject->AddRef();

Error:
    return hr;
}

.NET Framework Equivalent

None.

Requirements

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

See Also

Reference

Silverlight for Windows Embedded Functions