BackgroundColor for all windows - c#

In my WPF-application, I want that the user can change the background color like he or she wants. How can I set the background color from the one window where I can set it to all windows in my app?
How can I manage this?

You can dynamically reference (using DynamicResource) the same SolidColorBrush defined in the Application.Resources in the backgrounds of all windows, if you then replace this resource with another brush the windows will update.
Alternatively you could create a Brush property with change notifications somewhere (e.g. in some globally accessible settings in the App class) to which you can bind.

You don't say whether its a web or desktop app., nor whether you're using MVVM pattern or not, but I would suggest that you set this in the style sheet for your application. This is then referred to in the XAML for each "window".

Related

Xamarin.Forms Change Background Color For Application

I want to change the background color for the whole application. I have been searching but I found nothing. Of course there's a way instead of changing the background color for each page right? Hope to get an answer soon. Thanks in advance.
You can look into Xamarin.Forms Shell where the Shell is the container of the entire application. This would enable you to have the background defined at only one area instead of every page. Furthermore, it would allow you to customize it for specific pages if need be.
You can find their example application using a Shell called "Xanimals" here.

C# Winform: Remove the border from a standard button?

Is it possible to remove the border of a standard C# Button ? I know that I could set the FlatStyle property to Flat and customize the FlatAppearance property to hide the border but I would prefer to use the Standard property to ensure that the control appears under all operating systems like a default Button. Did you have any suggestions how I can solve this issue? I am working with a Windows Forms Application.
You could use an image and make it clickable, that is one way to avoid the borders, but there are several options. Good luck!
If you are using windows forms and trying to implement Flat UI, Material UI, Metro-Looking controls, you're in hell. It is has limited properties for customizations unless you know how to work with Graphics and Animation. You'll have to use imagebox or picture box and dynamically change its image on different events.
I'll suggest WPF or Windows Presentation Foundation for a more customizable User Interface.

how does the custom skins for c# 2010 work?

I'm still working on my c# application in changing the GUI and after googling around i found out that there are skins that can be used. I still don't understand how does this work, do i have to start from scratch? or will the skins merge along with my c# application. what changes will the skin do in my c# application aside from the GUI?
What i normally do for skinning is to remove form borders and set a background image,thus you can create forms of any shape.The steps i follow
Set the FormBorderStyle property to None.
Set the BackgroundImage property of the form to the .bmp you created above.
Set the TransparencyKey property of the form to the background color of the .bmp file
There are 2 parts to a winform client area and Non Client Area,You can do anything with the Client Area easily but None Client Area is uneditable.The Skinlibary you have mentioned in your comment hookes into windows message Loop to capture Events.
Check this answer to see how the Title bar color is changed Changing the color of the title bar in WinForm

Custom XAML styles for night mode

I have a XAML app (specifically a Windows 8 XAML app) that I want to add a night-reading mode for. This will be a setting a user can switch, and it will change the theme colors to be white on black, instead of my standard black on white.
My question is, how can I do this? I'd like to do it actively (meaning, the moment the user switches, I show the new version, and not have to make them restart them app).
I'm still fairly new to XAML, so I don't know if I'm overlooking something. Currently, I'm routing all my styles to go through staticresources in my themes file.
Thanks!
What you're looking for is a theme. Basically it's a set of globally available resources that you can swap out as a set. See here for an example.
Edit: I guess you can't change it without restarting: http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/f91a11d6-6e56-4978-8acd-21ae9f3c3a6e/

Custom look for C# windows applications

I'm making C# windows application ("Windows Forms Application") with default components, but I need to change default look of the form and all items on it (buttons, etc.) from classic windows style, to custom. How can I achieve it?
For example make buttons round, add transparency to some objects, make other objects with different shape, and so on.
It doesn't have to be customizable, but I just need to change it from default to something else. Maybe there's some components or something else that I can use? Or maybe there's additional GUI library that I can download and add to the project?
You didn't provide us with many details on how you want to customize the form.
You can change colors used on the form by setting the BackColor and ForeColor properties.
You can also apply background image to the form and use the TransparencyKey property in order to create a form with an irregular shape. More information about this method can be found here: http://msdn.microsoft.com/en-us/library/6k15y9et.aspx
Doing this manually and trying to have something looking nice takes waaay too much time. For start, look at this thread:
Best Free Controls for .NET

Categories