Still no support for “attached events” in Silverlight
After seeing several improvements in XAML, I thought I should run one last test: trying to use attach events from a Silverlight application. Attached events have been supported in WPF since v1.0. The idea is simple: you set up an event handler on a top element that is responsible for handling all routing events of a specific object. Here’s a small example:
<Button x:Name="bt1">Click me to see something</Button>
<Button x:Name="bt2">Or try me to see what happens</Button>
<TextBlock x:Name="info" />
The main advantage of using attached events is that you can define a “global” handler which is responsible for responding to all specific events fired by all controls of type X. Unfortunately, this feature isn’t still available in Silverlight 4.0 RC (and I’m not sure if it will ever be supported). That’s too bad, but life isn’t perfect, right?