Event Handler Flexibility

Event handlers can’t be assigned in a loose XAML2006 file, but they can be in a loose XAML2009 file as long as the root instance can be located and it has a method with a matching name and appropriate signature. In addition, in XAML2009, the value of an event attribute can be any markup extension that returns an appropriate delegate:

<Button Click="{custom:DelegateFinder Click} "/>

As with any markup extension, it can accept arbitrary input and perform arbitrary logic to look up the delegate.

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.