Closed FRvanderVeen closed 1 year ago
Hi @FRvanderVeen,
Thanks for reporting this.
Hmmmmmm, the hardcoded background there was to make it appear the same as WPF/WinForms, but you're right, that would mess up dark mode for Avalonia.
Not sure what the best fix would be at this exact moment to make it work on all themes out-of-the-box...in the interim you can always use your own IUIFactory
that passes in your own UI, but that's extremely inconvenient for such a small problem.
Is there a fix that would make it look good out-of-the-box on all themes? (Simple light, simple dark, fluent light, fluent dark)? I guess we could hard code the text color and everything too, but that's also not ideal since users using dark mode should be able to enjoy dark mode... (A DynamicResource that gets overwritten by the fluent theme if the theme sets it?)
I think the easiest solution is to remove the hardcoded background. That way you let the UI library determine how things look. I would expect that the update window looks the same as any Avalonia based window in my application.
For now I worked around the issue by attaching an event to the window opened event. Like so: https://docs.avaloniaui.net/docs/data-binding/binding-from-code#subscribing-to-a-property-on-any-object. That way I could remove the background on the grid. Besides that I also applied a fix for the titlebar that way. In dark mode titlebar is not in dark mode, which I found ugly. I now dynamically insert a textblock with the titlebar, because I set 'ExtendClientAreaToDecorationsHint' to true for all windows in my application, which also affects all SparkleUpdater windows
Hi @FRvanderVeen,
I have kept the hardcoded background (for compat reasons just so nothing bad happens) but have made this easier for you to clear in 2.1.3-preview20220927001
. The Avalonia UIFactory
now has a UpdateWindowGridBackgroundBrush
property that you can set to null
to clear the background (or set it to whatever you feel like). Can you let me know if that helps? Thanks!
Change rolling out now in CI/CD in version 2.1.3!
FYI: 2.3.0
previews have a few new properties on the UIFactory
that you may find helpful:
UseStaticUpdateWindowBackgroundColor
-- set to false
to avoid setting any background color on the update windowProcessWindowAfterInit
(func that provides a Window
and the UIFactory
that made it) -- use to handle any further styling issues you need to handle on a Window after it's been created and its view model has been set. Could be used to fix those other window styling issues you were experiencing.Note that UseStaticUpdateWindowBackgroundColor
is false
in the 3.x
preview versions (for Avalonia 11), so this won't be an issue by default in the future.
When using Avalonia in dark mode (in this case Fluent Dark) the UpdateAvailableWindow becomes unreadable: This is because the UpdateAvailableWindow has a background configured: https://github.com/NetSparkleUpdater/NetSparkle/blob/42f21fdc8e8ab1af9ba747788b9e918e5d20d4fb/src/NetSparkle.UI.Avalonia/UpdateAvailableWindow.xaml#L14-L16 When removing the fixed background color, everything works as expected. The fixed background was added in the initial commit