Convert an auto-property to a dependency property

Proprietary

An auto-property on a DependencyObject cannot be bound, styled or animated. Registers a DependencyProperty for it and rewrites the property to get => (T)GetValue(XProperty); / set => SetValue(XProperty, value);, keeping any initializer as the metadata default. A setter that is not public — or a get-only property — produces the read-only DependencyPropertyKey pattern instead.

OpenRewrite.Recipes.CSharp.CodeQuality.Wpf.ConvertAutoPropertyToDependencyProperty
mod run . --recipe=OpenRewrite.Recipes.CSharp.CodeQuality.Wpf.ConvertAutoPropertyToDependencyProperty

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.