← All recipes
Moderne licensed

Add [TemplatePart] for a looked-up template part

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Wpf.AddTemplatePartAttributeArtifactOpenRewrite.Recipes.CSharp.CodeQuality

A GetTemplateChild("PART_X") call in OnApplyTemplate is an undeclared dependency on the control template. Adds [TemplatePart(Name = ..., Type = ...)] to the control for every part it looks up but neither it nor a base control declares.

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

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

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