-
Notifications
You must be signed in to change notification settings - Fork 297
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
Change to Dark Theme not updating background. #194
Comments
What version of OS and Revit ? Autodesk.Revit.2023_2023.12.01-23.28_2.mp4 |
Windows 10 - 10.0.19045 Build 19045 I guess the last version I tested It's needed to close the dialog to apply the theme. |
Most likely the problem is related to windows 10. Unfortunately, both pomianowski (wpfui owner) and I have windows 11. I don't know if this bug will be fixed or not, but I won't be able to reproduce it, you can try to fix it if you have time |
Previously the theme and applied when opening a new window. But now I have added resource transfer to NavigationService when navigating in Frame. On Win 11 it works, on Win 10 it doesn't for some reason Can u debug it ? RevitLookup/RevitLookup.UI/Controls/NavigationView/NavigationView.Navigation.cs Lines 300 to 308 in b65685f
|
That's strange to have some relation with the Windows version. Yes, I can debug that, I think that is missing to update some resources. I having some similar issue when importing the |
The |
2.2 is very different from the current one, I use 3.0 preview. Thanks for the help in debugging |
I tried a lot of things, but in the end, looks like the resource is not refreshing the windows correctly for some reason. The only way I was able to work was by using this terrible approach in the Changed event. This force re-add the resource and the windows refresh to the dark mode, you could use that to refresh the other windows. RevitLookUp.-.ThemeChanged.-.2023-12-02.10-24-52.mp4I don't know what other change you made in the |
I think something needs to be done in NavigationView which inherits from Frame. All in dll applications there is such a problem that Page does not inherit resources from Window. Wpf ui was designed for exe applications where this is not observed. So as you show in the video the theme does not apply specifically to Page, Window is fine. So in this code RevitLookup/RevitLookup.UI/Controls/NavigationView/NavigationView.Navigation.cs Lines 300 to 308 in b65685f
|
events is certainly not the most efficient approach. maybe try to debug Apply https://github.com/ricaun/RevitLookup/blob/3917b7b5f2d88a076e03b7daf854352e8e240b85/RevitLookup/ViewModels/Pages/SettingsViewModel.cs#L54 method ? it contains a lot of OS dependent code |
I really don't know the reason in my machine the windows Ui does not update probably. Maybe is missing some trigger in the OS that force the window to update the resource. I'm testing the preview 3.0 and was able to make work inside Revit, in my implementation I'm using the Changed event to update the resource in each Window/Page. Without changing to much in the main Here is my PR. lepoco/wpfui#851 I gonna build a package and try swap the |
I don't really like the crutch of subscribing to events. I'm sure there is a more elegant solution. For now, for Win10 we can revert to the old code that changed the theme when new windows were opened partial void OnThemeChanged(ApplicationTheme value)
{
settingsService.Theme = value;
if (Wpf.Ui.Win32.Utilities.IsOSWindows11OrNewer)
{
ApplicationThemeManager.Apply(settingsService.Theme, settingsService.Background);
return;
}
notificationService.ShowSuccess("Theme changed", "Changes will take effect for new windows");
} |
This is not a primary problem, as very few people are still using WIn10, and losing performance to Win11 is not desirable for this purpose |
I tested on another machine with Windows 10 and had the same problem (tested in the Hosted Revit Preview Machine).
Yes, this approach is much better. |
@ricaun Hi Luiz, I've moved all the changes from the wpf.ui repository, there were some windows10 related fixes there recently, if you have time can you check the latest build from the dev branch? Specifically try commenting out the lines and leave only RevitLookup/RevitLookup/ViewModels/Pages/SettingsViewModel.cs Lines 64 to 70 in 5301493
|
Yes, it works! The theme changes in Runtime. RevitLookup.2023-12-25.21-32-15.mp4Now you already released, so the next version 😀 Merry Christmas 🎅🎄 |
Or not... I was messing with the Acrylic and Blur... Another issue maybe. RevitLookUp.-.2023-12-25.21-41-32.mp4 |
Oh great, that problem solved 🙃 What if in the Merry Christmas 🎅 |
The only one that breaks the Dark UI is the If I disable the If I disable this, the |
The |
I need to check where it came from |
I think it's worth disabling all background effects in Windows 10 for now as they don't work there,maybe they will be fixed in wpf.ui in time. And unfortunately I can't test this, so I'm using 11 |
By the end of the week I think to publish Release with fixes, but in the meantime it's worth to look for any more bugs @ricaun In general, keeps the Runtime theme switching, but turn off all background effects? |
Probably in the installation, the ru is not moved or deleted. I don't like to use these resources for multiple languages, the extra folder/dll is annoying. Most of the time I create a json/object and swap depending on the CurrentUICulture. The ColorRepresentationUtils already have a KnownColors Dictionary, and swapping should be easy. I could create a PR if you think that makes sense, with a JSON at least gonna be easier to translate to other languages 😀 |
Yes, turn off all the background effects in Windows 10. I gonna test the UI.Demo it in the Autodesk machine to see if works fine. |
There was a problem with the installer, I wrote code that handled subfolders badly and duplicated them to the root directory. this has now been fixed. this was not observed during debugging or compiling with Nuke |
Oh, you remove the background effects options, neat! |
and why display them if they are not supported? I can keep it, it doesn't matter |
I'm not sure if Visual Studio has this csv import, never needed something like that.
The structure would be something like this: KnownColors.json {
"000000": "Black",
"000080": "Navy blue",
"0000FF": "Blue",
"FFFFCC": "Conditioner",
"FFFFFF": "White"
} Just deserialize to a You could store the file KnownColors.json in the Resources, better than each key separately. The |
I would still prefer to use Resx files, it is still a native way of localisation, and especially if we need to localise Xaml files or parts of it, Json is not suitable for such tasks, and it is bad practice to have several ways of localisation 🙈 For JSON you will also have to duplicate keys in all languages as I understand, which is not convenient. I follow the principle of using the format most applicable to the task, not using only 1 way because it is popular, Json is good for web, yes, but here it is bad, csv is suitable especially you will never use |
The only reason to use JSON is that is convenient to convert to c# object. Instead of using: private static readonly Dictionary<string, string> KnownColors = new()
{
{"000000", Resources.Localization.Colors._000000},
{"000080", Resources.Localization.Colors._000080},
...
{"FFFFFF", Resources.Localization.Colors.FFFFFF},
}; Would be something like: private static readonly Dictionary<string, string> KnownColors =
Encoding.UTF8.GetString(Resources.Localization.Colors.KnownColors)
.ToJson<Dictionary<string, string>>(); Still gonna have the |
@ricaun I'll talk to the Microsoft guys about it. In the meantime we need to see if what we discussed above is fixed. If you have time, you can check out the latest dev build, and we'll roll out the Release on Friday |
The background effect is working. And dark background is not updating the other windows, I don't remember if was working before... RevitLookUp.-.2023-12-27.16-56-51.mp4Maybe is better to just add the partial void OnThemeChanged(ApplicationTheme value)
{
settingsService.Theme = value;
if (Wpf.Ui.Win32.Utilities.IsOSWindows11OrNewer)
{
ApplicationThemeManager.Apply(settingsService.Theme, settingsService.Background);
return;
}
notificationService.ShowSuccess("Theme changed", "Changes will take effect for new windows");
} |
previous windows will not be updated, only new windows and the current window 🙃I didn't write the logic for updating old instances. I don't need to fix it for now, but rather focus on new tools, plans are in the works for BIP checker as many people have asked for, Modules and more. But for now I have a lot of work to do, so Lookup will be in the background |
I assume that was already done. You could use the Theme event to trigger the other windows to swap the resources. Is visually pleasing when you change the theme and all windows themes change as well. 😀 |
You can do it if you want to) |
I did a PR #200. I update the |
Then I reckon we're ready to make the last release of this year) |
The result is the same, only we don't touch the UI library) which makes it easier to port patches unknown_2023.12.29-01.54.mp4 |
I updated the latest version and tested it in Revit 2024 and noticed that when changed to theme Dark the background color is not changing.
If I close and open works fine.
Here is a video.
RevitLookUp.2024.0.10.-.2023-12-01.16-32-56.mp4
The text was updated successfully, but these errors were encountered: