Good afternoon, I'm starting in the world of programming in C # in WPF platform and I have a question and hopefully could help me ..
How I can change the color of the windows of my application? Allowing the user to choose between several colors and according to the color chosen the windows color change.
I appreciate them so much that they could help me.

VulpesRank #55 · 29.2K reputationPosted Oct 30, 2014, 10:43 AM EDT
To do that, you'll first need to add references to System.Windows.Forms.dll and System.Drawing.dll to your project.
If you then want the user to be able to change the color of the CURRENT window on (say) a button click, the following code should work:
// change background to color selected by user
this.Background = scb;
with this :
foreach(Window w in Application.Current.Windows) w.Background = scb;
However, if you open or reopen any more windows, you'll need to remember to change the Background property before they're displayed.
Mahesh ChandRank #1 · 393.3K reputationPosted Oct 31, 2014, 7:47 AM EDT
Shweta LodhaRank #31 · 39.8K reputationPosted Oct 30, 2014, 10:27 AM EDT
Roman Badillo7 reputationPosted Oct 31, 2014, 7:33 AM EDT
Roman Badillo7 reputationPosted Oct 31, 2014, 7:39 AM EDT
Mahesh ChandRank #1 · 393.3K reputationPosted Oct 31, 2014, 7:47 AM EDT
VulpesRank #55 · 29.2K reputationPosted Oct 31, 2014, 8:04 AM EDT
internal static SolidColorBrush CommonBackground;
public MainWindow()
{
InitializeComponent();
CommonBackground = (SolidColorBrush)this.Background;
}
// ....
if (dr == System.Windows.Forms.DialogResult.OK) {
var smc = System.Windows.Media.Color.FromArgb(cd.Color.A, cd.Color.R, cd.Color.G, cd.Color.B);
scb = new SolidColorBrush(smc);
this.Background = scb;
//foreach (Window w in Application.Current.Windows) w.Background = scb;
CommonBackground = scb;
}
You could then access it from any other window in the application using the expression MainWindow.CommonBackground.
If you wanted to save it between application sessions, you'd have to save the ARGB components (say) to a text file and then load that, reconstruct the SoildColorBrush and set the static property the next time the application was run.
MahaRank #2,573 · 543 reputationPosted Oct 31, 2014, 9:21 AM EDT
I have sent many emails to you people about this problem, but no reply. Please look into this matter.
Mahesh ChandRank #1 · 393.3K reputationPosted Oct 31, 2014, 10:11 AM EDT
MahaRank #2,573 · 543 reputationPosted Oct 31, 2014, 10:22 AM EDT
MahaRank #2,573 · 543 reputationPosted Nov 2, 2014, 11:01 PM EST