CreateDelegate(class,class::method,IXRDelegate<ArgType>) (Windows Embedded CE 6.0)
1/6/2010
This function creates a delegate for an event. The delegate represents the event handler that you specify in the parameters.
Syntax
template <class T, typename ArgType>
HRESULT CreateDelegate(
T* pT,
HRESULT (T::*pfn)(IXRDependencyObject*, ArgType*),
IXRDelegate<ArgType>** ppResult
)
Parameters
- pT
[in] Handle to an instance of a custom handler object that implements the event handler.
T::*pfn
[in] Handle to a method in the custom handler object that handles the event associated with the delegate.This parameter provides the fully qualified name of the event handler that handles the particular event that you want a delegate for, combined with the name of the event that the delegate handles.
For example, the following value indicates the creation of a delegate for an OnMouseMove event handler implemented in an object named CustomEventHandler:
&CustomEventHandler::OnMouseMove
- ppResult
[out] IXRDelegate<ArgType> template class that Silverlight for Windows Embedded has customized for the event handler that you specify in T::*pfn.
Return Value
Returns an HRESULT that indicates success or failure.
Remarks
When you use this helper function, you can first create a custom object that provides custom event handlers. Then, you can pass an instance of that object into pT.
CreateDelegate creates a delegate template class that represents the event handler that you specified in T::*pfn. Then you can work with this delegate directly to attach its event handler to an event on a particular object.
To attach the associated event handler to an event on a particular object, you can attach the returned delegate to that object. To do this, use the return value as an input parameter for methods that add delegates to UI objects such as objects derived from IXRFrameworkElement. If you have attached the event handler to a UI object, the UI object will use the delegate to invoke the event handler every time that the object raises the event.
.NET Framework Equivalent
None.
Requirements
Header | XRDelegate.h |
sysgen | SYSGEN_XAML_RUNTIME |
Windows Embedded CE | Windows Embedded CE 6.0 R3 |
See Also
Reference
CreateDelegate
CreateDelegate(class,class::method)
Silverlight for Windows Embedded Functions