Which class should be Singleton in WPF, MVVM structure? [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I know my question is subjective and context dependent, but being a beginner to MVVM, I came to know that generally one of the MVVM class is made singleton. Can anybody please tell me if I have Model, ViewModel and View class, generally people prefer which class as singleton and why is it so?

Technically, the Application class is really the only "required singleton" in a WPF application, and that's mainly because WPF will create it for you.
Otherwise, I typically avoid singletons in my WPF applications completely - there is no reason to introduce them.

Related

Question about the structure of the MVVM pattern [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
My English skill is poor because I'm not a native English speaker.
I hope you to understand.
I have written an application whose structure is MVVM in WPF.
An idea floated into my mind while writing an application.
In MVVM pattern, I know that the ViewModel must split with View and to achieve this goal we use behavior, attached property, EventToCommand of the MVVM Light, etc situationally.
But I think that using together more than two skills of the above skills to handle the event of View on the ViewModel complicates the connection structure of the whole logic.
So... I curious what it's like to drive the all logic to handle the event of View into Behavior situationally.
Perhaps the structure looks like this:
ViewModel has only a data structure to connect with View and logic related to the data structure. (Ex: TestViewModel)
The logic of the ViewModel only is written on Behavior. (Ex: TestViewModelBehavior)
Thank you for reading.
I can't understand what is your problem correctly, maybe because my English skill is poor too :) but:
I think you can inherit TestViewModel from TestViewModelBehavior or if you want to have different Behavior in each ViewModel you can inject different implementations of TestViewModelBehavior to TestViewModel.
I hope to help you.

WPF and MVVM tips [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm new to WPF and MVVM pattern. I've been reading about it and I come to a little doubt.
I'll build an WPF application that mainly does access to a database (oracle), but this access is done by an WebService (DataService). My question is in the Model part.
Should I create a class to each table on the database, on my Model, or should I just use the entities that the service provides me?
My guess is use the entities of the service, and then just do the CRUD operations in my application. But I want your opinion.
Thanks in advance.
It is always a good practice to use your own Models. That way, if the Service changes the structure, you will only need to change one point (where you map the item to your own entity), else you would have to change your whole application

WPF Dependency guide [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I’m trying to learn some WPF tricks and I’m stuck on WPF-Dependency.
Can anybody explain what is it and it’s use. Any websites with the explanation of using it.
What is Dependency
Dependency means an object depending upon another object.
An object O1 depends upon another object O2 when O1 is using O2's property to do some changes in its own(O1) property.
Why we need it
To achieve these changes, some notification logic is needed of-course. Before WPF or similar technology, we were doing it using event handlers.
Now, with WPF and similar technologies, we tell the underlying framework to do this for us. We tell underlying framework what we want ( using some syntax ) without bothering how ? And underlying framework does this for us.
Provisions provided by WPF
Binding using code/xaml.
DependencyProperty
Triggers
INotifyPropertyChanged interface
Learn about these, and slowly you will get the hold of it.

Suitable Design pattern for building a 3D model [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have implemented a 3D model application using DirectX api and C# .NET. Initially started with an intention to make the 3D model working and by now, all the code logic and UI stuff everything is in one *.cs file i.e., in main form.
Could you please anyone suggest me which design pattern is suitable for segregating my code in a proper way?
As MVVM (Model-View-ViewModel) pattern is suitable for WPF application, Im under the impression that the same design pattern can be suitable for 3D rendering application.
Please suggest me if any other design pattern is well suitable for my 3D modeling application. Thanks in advance.
Regards,
Kumar
MVVM design pattern is for frameworks with data binding, such as WPF and Silverlight, if you are using windows forms I'd suggest Model View Presenter or Model View Controller patterns

Good Silverlight Custom ItemsControl Tutorial [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm afraid my Google-Foo is failing me again today. I'm trying to find a good tutorial on creating custom ItemsControls in Silverlight (though I imgaine a WPF version might work as well).
I'm trying to create a custom ItemsControl that will be something of a virtualized ListBox. What I'm trying to accomplish isn't really similar enough to the current ListBox control to justify trying to modify the existing control, so I figure a custom one is in order here. I have a vague concept of how to accomplish it, but there are definite holes in my understanding.
Thanks in advance
See http://www.ladimolnar.com/Home/ViewArticle.aspx?ArticleName=HowToCustomizeAnItemsControl.
The article has a link to a sample app and sources. The sample app has a custom ItemsControl that also implements virtualization.

Categories