How I do change WPF background color with xaml style?

Roberto Carrer 1 Reputation point


In my WPF test project I tried to make the style dynamically changeable through a combobox. Everything works except the background color of the windows.

I have tried with StaticResource, with SolidColorBrush, with the same name, with different name of static resource but it does not work!

Can you help me?

The source code is here.
Thank you!

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,665 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Roberto Carrer 1 Reputation point

    Hi. TryFindResource always return null!
    Your solution not solve my problem.

    I have resolved my problem changing from StaticResource to DynamicRecource.

    See the Git repository for solution.

    0 comments No comments