← All recipes
Moderne licensed

Convert a CLR event to a routed event

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Wpf.ConvertEventToRoutedEventArtifactOpenRewrite.Recipes.CSharp.CodeQuality

A CLR event on an element cannot be routed through the element tree or handled by a parent. Registers a RoutedEvent for it with EventManager.RegisterRoutedEvent and rewrites the event to add/remove accessors calling AddHandler/RemoveHandler.

Single recipecsharpcode-qualityProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe OpenRewrite.Recipes.CSharp.CodeQuality.Wpf.ConvertEventToRoutedEvent

If the recipe isn’t available locally, install it with:

mod config recipes nuget install OpenRewrite.Recipes.CSharp.CodeQuality