Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Application.RenderWithVisualStyles is always false - how can we set it to true? #2453

Open
hughbe opened this issue Nov 30, 2019 · 0 comments

Comments

@hughbe
Copy link
Contributor

@hughbe hughbe commented Nov 30, 2019

Basically I want to test some code that is conditional on Application.RenderWithVisualStyles

The issue is that Application.RenderWithVisualStyles is always false

The docs (https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.application.renderwithvisualstyles?view=netframework-4.8 say
image

Doing research, I found that VisualStyleInformation.IsEnabledByUser is always false

VisualStyleInformation.IsEnabledByUser is implemented as

/// <summary>
///  Returns true if a visual style has currently been applied by the user, else false.
/// </summary>
public static bool IsEnabledByUser => UxTheme.IsAppThemed().IsTrue();

Is there a way to make UxTheme.IsAppThemed return true when running tests from dotnet test? When we call dotnet run, this works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.