Search code examples
c#wpfbinding

WPF , How to change the background color of the "main window" from "Setting window"?


I wrote a WPF program where I want to change the background color of the main window using the settings window. Project requirements:

1- The settings window should be able to save the colors in a variable and display those colors again the moment the settings window is opened again.

2- The background color of the main window should be perfectly Binding to the colors in the settings window, which will be applied immediately when changes are made.

My WPF Project

I tried several methods including:

1- I defined a global variable of type LinearGradientBrush in the code behind the main window.

2- I defined a global variable of type LinearGradientBrush in the app.xaml file.

But none of these methods worked properly


Solution

  • I Found A Project That Is Exactly What I Imagined In My Mind. I Put The Source Link Of The Project Here.

    Project Solution

    First Project Preview