Filters are used to decorate Actions and Commands. They can alter input and output parameters as well as handle exceptions or prevent the execution of the Action/Commands that they decorate. There are several filters provided out of the box, but you can also
implement your own.
There are several custom filters available out of the box:
||Implements a pre-condition for method execution. Set the AffectsTriggers to true to allow the condition to affect the UI state, false otherwise (true is the default).
||Decorates a class or method and redirects unhandled exceptions to the specified method.
||Besides enabling asynchronous actions, it serves as a post-execute filter for custom UI-bound callbacks.
You can also implement your own filters by inheriting from Attribute and implementing one or more of the following interfaces:
||Enables a filter to handle exceptions.
||Allows a filter to intercept input parameters or cancel the execution of a method.
||Allows a filter to intercept the return value of a method. This is always called on the UI thread.
||Allows a filter to hook into various aspects of the decorated classes at runtime. Mainly, provides access to IRoutedMessageHandler and IMessageTrigger.
In addition to these interfaces, you may also wish to implement IInitializable if your filter needs to execute custom initialization logic.
You can see an example of a custom filter in use in the CustomFilters sample.