Поделиться через


IXRCustomEvent (Compact 2013)

3/28/2014

This C++ class represents a custom event that a data-source object raises when a data-source property value changes.

Syntax

template <typename ArgType, typename SenderType>
class __declspec(novtable) IXRCustomEvent : public IUnknown

Methods

Method

Description

IXRCustomEvent::Attach

Adds an event handler to a custom event.

IXRCustomEvent::Detach

Removes an event handler from a custom event.

IXRCustomEvent::Raise

Raises a custom event.

Thread Safety

Members of this class are thread-safe if you previously called IXRApplication::CreateHostFromXaml and supplied it with an XRWindowCreateParams structure that has AllowsMultipleThreadAccess set to true.

Remarks

When you create a custom C++ data-source object for data binding, also create a custom event by creating an instance of IXRCustomEvent in that object. This IXRCustomEvent instance represents the event to raise when a data property changes. You create the IXRCustomEvent instance using the CreateCustomEvent<ArgType,SenderType> helper function. For example code, see IXRPropertyBag.

Next, when you implement a custom method in the data-source object that changes a source-data property value, call IXRCustomEvent::Raise in that method to raise the custom event.

You can also attach delegates for UI events of XAML for Windows Embedded UI objects to the custom event by using IXRCustomEvent::Attach. After you do this, the UI object's event handler can handle the data-changed event when it is raised.

When you create a class instance, use an IXRCustomEventPtr smart pointer instead of a raw interface pointer. For more information, see XRPtr<Interface>.

.NET Framework Equivalent

None.

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

Classes for Populating UI Elements with Data
IXRPropertyBag::GetPropertyChangedEvent
IXRNotifyCollectionChanged::GetCollectionChangedEvent