C
C#16mo ago
ancientfuture

❔ Best approach to share several properties application-wide in a WinUI3 project?

Hi, I am looking for the preferred way, following the best practices for a small scale desktop application, to share properties from various ContentDialogs, UserControls and a Window throughout the application such that the data is accessible from the other ContentDialogs or UserControls. The approach I have in my right now is to create a static SessionState class to store all the properties in one place and use it to access the saved properties of the current Desktop session of the application using it. Out of the blue, a related query is that can I use Dependency Injection here to achieve the same? If yes, any advice will be very helpful. A SessionState class is also required by us to be able to implement the New Open and Save file functions in our application. So is it a good idea to use a static class for this purpose? I am a beginner w.r.t project architecture and Dependency Injection (but if it's useful here, I will give it a go!) and this is my first time creating a desktop application, using C#. I have experience with web applications. So any advice in moderately laymen terms will be greatly appreciated. Thanks!
1 Reply
Accord
Accord16mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.