Is there a one-liner way to override the user's accent color in UWP for my application? I've been searching for this but apparently one would have to create a dictionary with each variation of the user's accent color. What I would like to do is simply change it from whichever the user selected to another one from Window's default accent colors.
I'm building an application for a local business and it's more important to them to have their colors on the application instead of whichever the computer's configured to use. Luckly, their "accent" is a color very close to Window's yellow accent color, so changing the accent to be used in the application to that would be very helpful.
What you’re looking for is the ColorPaletteResources API.
By using it, you can override any of the System color in your app, including the Accent color itself.
It requires Win 10 1809 or higher.
It seems, however, to be some bug in it: by some test I’ve already done in the past, it seems to be working only when used in XAML (or before the InitializeComponent() in a page constructor) and it works apparently only for the Accent.
But this API is the most straightforward way of overriding System colors, as for now.
Best regards.
As far as I'm aware there is no one-liner, you'd need to override each as shown below:
<Application.Resources>
<ResourceDictionary>
<Color x:Key="SystemAccentColor">#107C10</Color>
</ResourceDictionary>
</Application.Resources>
Related
Is there a way to change the pressed effect of a button on Android in a .NET MAUI project. Now it is showing a dark ripple effect when dark mode is on and a white ripple effect when the light mode is on.
I would like to have the same ripple color for both dark and light mode. I tried to change the colorPrimary and colorPrimaryDark values but nothing changes.
The simplest way to achieve parity in both modes (and potentially across platforms) might be to override the button's default style with your own.
You can look into the default button style template, make a copy in you apps resources, and change the colors used to from default staticresource or dynamicresource to your desired color palette.
Yes, WPF.
How to retrieve accent color that the user has chosen in Windows settings into a desktop WPF application?
for example for a Button?
I'm not sure which version of .Net you're using, but if you're using 4.5 or higher, you can use the SystemParameters class. I think the property you more than likely are after is the WindowsGlassBrush.
this.Background = SystemParameters.WindowGlassBrush;
Note though, that the properties in this class are marked with SecurityCriticalAttribute, so you will more than likely need full trust to access them.
I wanted the XAML version of Richard Preziosi answer, that would be :
BorderBrush="{Binding Source={x:Static SystemParameters.WindowGlassBrush}}"
How do you apply stroke (outline around text) to a TextBlock in XAML in a Windows 8 store app (not WPF)?
A very similar question was asked in 2008, but the suggested solution from Apply stroke to a textblock in WPF and the referenced https://msdn.microsoft.com/en-us/library/ms745816.aspx only work on Windows Presentation Foundation (WPF) applications. The effect I am looking for is the same.
Thanks for your help!
I have successfully done it with Win2D effect http://expediteapps.com/blog/textblock-with-win2d-effects/
The idea is to apply two effects that create the outline effect. You can experiment with different ways and find the best combination you need. To add Win2D you can get it by nuget and is really easy to use.
and you do not need to convert the font to any strange glyphs.
I'm working in a WinForms project.
I have a dark theme activated in Windows and this is a default combobox when it's focused:
And this is when it has no focus:
An horrible and insane white border appears when the control lost focus, I want to avoid that without disabling XP Styles in the project.
I know that maybe the only way is inheriting the control to make my own, the problem is I don't know what I need to do with the control, maybe changing a setstyle property or I don't know.
I think you're trying to solve a problem that isn't in the scope of your application. Isn't this just an issue with the theme in question you are using?
Windows has many themes. The major themes still supported are Classic (pre-XP), Luna (XP), Aero (Vista/Win7), and Modern (Windows 8). All of these can be customized to create an infinite number of possible scenarios.
Most Windows Forms controls are based on Win32 controls which are drawn by the OS according to these system themes.
So you have to understand that on the machine you're testing on what you're seeing is going to vary a lot from what users of the application will see on different versions of Windows with different user preferences.
The simple fact is that if you use WinForms base controls you really should surrender control of the appearance to the OS as much as possible.
It's also widely accepted to create your own application theme that the user can't change or that they have to pick from a predetermined set of themes you have created. Examples of this include Google Chrome, iTunes, Winamp, etc. It is typically an awful lot of work to do this with simple Win32 controls unless you use something like WPF which makes it easier.
The important thing is that you can't really pick and choose which parts of your application to theme. If you want it to look consistent you either take responsibility for the entire theme yourself or follow the Windows standards of using system resource colors such as ControlText, ActiveBorder, AppWorkspace, etc.
It is kinda baby question but it is important for the visual appearance of my app.
When I installed Windows 8 DevPreview on my PC os proposed me to choose the color scheme for Metro UI. I preferred teal color. It is something like next:
So I have this color scheme for background and for setting background. Now I want to implement the custom setting for my app. Something like next:
But for good user experience, I want to keep my settings in the same color that system. In the current moment, I set settings background manual. But it isn't a solution because a user can prefer another color scheme. I've checked in StandardStyles and in main generic XAML file. But looks like that I missed it. I would be pleasure if anybody help with this.
This value is not available in the current SDK. Though the initial settings flyout pane does match the system color, you'll notice that any custom settings panes are usually white or a color that matches the application.
Take a look at the Bing Weather app and you'll see what I mean. All of the applications custom settings have a blue background (even though I personally have a teal theme).
Also, don't get confused by the "Permissions" settings. That dialog is also provided by the OS.