Do not set DataContext or Style using SetCurrentValue
Recipe ID
OpenRewrite.Recipes.CSharp.CodeQuality.Wpf.UseSetValueForDataContextAndStyleArtifactOpenRewrite.Recipes.CSharp.CodeQualityDataContext and Style are inherited through the visual tree, so a value written with SetCurrentValue is discarded as soon as the inherited value changes. Replaces the call with SetValue.
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.UseSetValueForDataContextAndStyleIf the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.CodeQuality