Do not set DataContext or Style using SetCurrentValue
ProprietaryDataContext 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.
OpenRewrite. Recipes. CSharp. CodeQuality. Wpf. UseSetValueForDataContextAndStylemod run . --recipe= OpenRewrite. Recipes. CSharp. CodeQuality. Wpf. UseSetValueForDataContextAndStyleInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.