-
- anton.sodergren_pdx
- Posts: 21
- Joined:
Hot reload of global resources
Hi, I just wanted to check something about hot reloading.
Whenever a XAML file for a window is changed while the game is running, it is properly reloaded. However, when a XAML file containing global resources is changed, we do call RaiseXamlChanged, but nothing seems to happen.
Is this the expected behaviour? Is there simply no support for hot reloading global resource files? And if that is the case, are there any plans for implementing support for this?
Whenever a XAML file for a window is changed while the game is running, it is properly reloaded. However, when a XAML file containing global resources is changed, we do call RaiseXamlChanged, but nothing seems to happen.
Is this the expected behaviour? Is there simply no support for hot reloading global resource files? And if that is the case, are there any plans for implementing support for this?
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: Hot reload of global resources
Hi Anton,
Reloading ResourceDictionaries is not working yet, only xamls of objects connected to the visual tree are reloaded right now.
We have plans to implement support for that in the following major version.
Reloading ResourceDictionaries is not working yet, only xamls of objects connected to the visual tree are reloaded right now.
We have plans to implement support for that in the following major version.
-
- anton.sodergren_pdx
- Posts: 21
- Joined:
Re: Hot reload of global resources
Hello again! It was a while since I made this thread, but I want to revive it since this is very much related.
Is it correct that hot reloading of global resources was implemented? The patch notes for 3.2 mentioned that the hot reload algorithm was reimplemented. And the documentation page for Hot Reload mentions resource dictionaries and theme modifications, so I would make the assumption that it is now supposed to work.
For quite a while now, we have had a file watcher that has manually brute force reloaded everything, including both resource dictionaries and all views, whenever any XAML file changes, since we couldn't rely on the built-in hot reload functionality due to the missing support for global resources. But as you can imagine, this is quite slow to do whenever a XAML file changes. So we wanted to do another attempt at making use of the built-in functionality instead. After having hooked up our file watcher to notify the XAML provider, hot reloading user controls or resource dictionaries that are referenced as merged dictionaries from the user controls work just as I would expect, and it is quite quick! However, for XAML files that are global resources, it seems like nothing is happening, and in the log file it doesn't look like it's trying to load the file.
Do we need to do something special for hot reloading of global resources, or is it still just not implemented? We are currently on version 3.2.3.
Is it correct that hot reloading of global resources was implemented? The patch notes for 3.2 mentioned that the hot reload algorithm was reimplemented. And the documentation page for Hot Reload mentions resource dictionaries and theme modifications, so I would make the assumption that it is now supposed to work.
For quite a while now, we have had a file watcher that has manually brute force reloaded everything, including both resource dictionaries and all views, whenever any XAML file changes, since we couldn't rely on the built-in hot reload functionality due to the missing support for global resources. But as you can imagine, this is quite slow to do whenever a XAML file changes. So we wanted to do another attempt at making use of the built-in functionality instead. After having hooked up our file watcher to notify the XAML provider, hot reloading user controls or resource dictionaries that are referenced as merged dictionaries from the user controls work just as I would expect, and it is quite quick! However, for XAML files that are global resources, it seems like nothing is happening, and in the log file it doesn't look like it's trying to load the file.
Do we need to do something special for hot reloading of global resources, or is it still just not implemented? We are currently on version 3.2.3.
Re: Hot reload of global resources
Yes, this approach should work. If you manually merge the global dictionary XAML into one of your existing XAML files, do the resources reload correctly in that case?
Could you please create a ticket for this issue?
Could you please create a ticket for this issue?
-
- anton.sodergren_pdx
- Posts: 21
- Joined:
Re: Hot reload of global resources
Hey, indeed if I simply add it to a merged dictionary in the view, it does actually reload as expected for that view. But if it's just used as a global resource, the file doesn't reload (LoadXaml in the XAML provider doesn't get called even though the XAML provider is notified that the file has changed).
Sure, I can create a ticket.
Sure, I can create a ticket.
-
- anton.sodergren_pdx
- Posts: 21
- Joined:
Who is online
Users browsing this forum: Bing [Bot] and 5 guests