AttachedPropertyEvent Pattern
Introduction
In our project we use the Composite WPF model, and we needed a way to publish events from our views (XAML code) without creating any code-behind, and without having any dependencies. To publish and subscribe to events, we already used IEventAggregator, but still we had to write some code-behind in order to publish the events.
So we came up with what we call "AttachedPropertyEvent".
About the Example
In this example, I'm going to implement SelectedItemsChanged on a datagrid. The datagrid resides in a view, and I wish to subscribe to this event in some viewmodel.
Implementation
First we create an AttachedProperty with get and set methods, and a callback to perform some logic. This class resides in our Infrastructure project, and namespace Events.
Comments