views:

12

answers:

1

It seems that the entire power of routedevents is directed towards UI development. Meaning to ask, would it be possible to raise a routed event from a class that does not extend a UIElement or UserControl class at all? For example: I create a State class that I that performs several changes on some data (mainly drawings and objects) and I want the to inform the main UI so that it can update its Adorners and cause a repaint of the visual element.

I think it's good to also somewhat decouple this State class from the UI instead of creating an event handler that the main UI should directly attach to if it wants to service this event.

Is there a way to achieve this or am I completely off?

+1  A: 

You should look up the ICommand interface and implement it in a custom command class.

Alternatively, you could look up the RelayCommand implementation that allows for the definition of a command without the need for implementing a class.

For the difference between the RoutedCommand and the RelayCommand you can read this discussion.

Obalix
Quite the revelation! This looks like what I have been looking for.Thanks for the help!
dansam100