Another concept of the WPF are so-called "routing events". You react to routing events with so-called "event handlers". However, event handlers only work in conjunction with code-behind files in Visual Studio, since XAML is compiled with the code-behind file. In iPlus, XAML designs are loaded at runtime. The connection to a business object or ACComponent is therefore only made via data context , which is automatically set for the VBVisual and VBDesign control elements by the iPlus framework. Event handlers must therefore be provided in the ACComponent as normal client-side methods with the ACMethodInteractionClient-Attribute class:
Alternatively, you can also define client-side scripting methods in the iPlus development environment.
Important: If you declare the method in a business object, you can use normal methods with the "ACMethodInfo" attribute class as event handler methods. This is possible because a business object can never exist as a proxy object in comparison to instances from the application projects. With these methods, the mandatory first parameter, for which the IACComponent reference is passed, is also omitted.
After you have defined the method, open the tool window and the properties window in the designer. In the properties window, switch to the events list by pressing the "Events" button (1):
Expand the method area in the tool window and use "Drag & Drop" to move your event handler method to the event to which you want to react with this method (2) . The example responds to the MouseLeftButtonUp event. If you also select the "OnlyOnDblClick" checkbox, your method is only called when you double-click.
Then switch to the XAML editor. The following code was generated:
An event handler named VBDelegateExtension was assigned to the event. VBDelegateExtension is a markup extension from the gip.core.layoutengine. VBDelegateExtension has the ability to make ACUrlCommand calls and thus to call the client-side method described above. In the example, the ACUrlCmd property was only set with a preceding exclamation mark and the method name. This is a relative call to the bound ACComponent (DataContext). The call can of course also be specified absolutely.
Setting the OnlyOnDblClick property in the properties window has the following effects in the XAML code: