← All recipes
Moderne licensed

Cast the sender of a dependency property callback to the containing type

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Wpf.CastSenderToContainingTypeArtifactOpenRewrite.Recipes.CSharp.CodeQuality

A direct cast of the sender in a PropertyChangedCallback or CoerceValueCallback should name the type that registered the property rather than a base type, so that the cast documents what the sender really is.

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.CastSenderToContainingType

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

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