I am currently experimenting with Roslyn and Code Actions, more specific Code Refactorings. It feels kind of easy, but I have a difficulty I cannot solve.
Code actio
You can choose to override ComputePreviewOperationsAsync to have different behavior for Previews from regular code.