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 8 years ago.
Improve this question
I am trying to follow standard MSDN steps to form up MVVM architecture in WPF. My folders and class hierarchy are as below.
Models
=> FormModel.cs
ViewModels
=> MainViewModel.cs
=> ViewModelBase.cs
Views
=> MainView.xaml
and
=> App.xaml
Please consider these above all in standard approach.
Now I want to create RelayCommand method about which I don't have any idea. Can you please tell me where to put it? Should I create a separate Command folder? Or under any of above folders? Also give an example of RelayCommand if possible as I don't know how to implement RelayCommand method.
I would vote for ViewModels in this case - the implementation is only going to be used in ViewModel classes. I wouldn't create a Command folder, as it will sit in there on its own, but if you have similar constructs perhaps a Utilities folder?
Instead of reinventing the wheel, I use MVVMLight from Nuget (others are available) - has a RelayCommand implementation included, and can be used in portable class libraries (for store apps).
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Due to some reasons I should create my own UI/GUI library for some apps. After a lot of searching I did not find suitable info for the project except this link.
This is the nearest thing to my idea that I've found yet.
Now I'd like to know how companies like Telerik could create these libraries, and how can I create some for myself? Do they use OpenGL or something like that to provide these libraries to the customers? What are the keywords that I should search for to learn the technology.
Thanks.
A typical "UI library" like for example the one that Telerik provides for WPF is basically just a bunch of control classes that inherit from a built-in base class like for example System.Windows.UIElement, FrameworkElement or Control.
So a good staring point would be to create a class library based on any of the WPF Control Library template and add some classes and XAML templates to it.
You don't have to provide your own custom rendering engine to build a "UI library".
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am trying to implement Serilog in our enterprise WPF application built using Prism Library. Google search shows that I need to implement a custom class that inherits from ILoggerFacade but I don't know how to do that because the function void Log(string message, Category category, Priority priority); does not log the messages in the format I would like to and I would like to implement a custom logger that has the properties of Serilog.
How do I do this ?
TL;DR; Just use the Prism.Logging.Serilog library.
All you have to do is create a class that implements ILoggerFacade, and that forwards log messages to your Serilog logger. Use an instance of that class when you configure your Prism bootstrapper.
Use that class on your bootstrapper.
Everywhere else in your application, you can use Serilog's ILogger and completely forget about ILoggerFacade...
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
Lately I have successfully implemented a desktop application using WPF technology with MVVM achtitecture and Prism. I am very happy with how the entire, quite large project emerged, and how it is easy to maintain the entire application now. No questions about the MVVM, I am already sold on that one, but how about the Prism, would you consider that a good choice when it comes to implementing the MVVM pattern? I am quite happy with the product, but I was wondering what is your opinion on it?
Short answer: No.
Longer answer: Prism is a Composite Application library, which provides features for creating composable applications, including MVVM patterns.
However, in my opinion, MVVM can be achieved using simpler frameworks like MVVMLight and Caliburn.Micro. If you don't need the extra features that Prism provides then I wouldn't use it. Extra functionality is just more code that can break, if you're not using it.
Is Prism a good product? Yes.
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 4 years ago.
Improve this question
I have been looking at the Model-View-ViewModel pattern that is suggested by several people out there (especially John Gossman, take a look at this post and this podcast), but what other patterns (if any) have people used and liked ... and where do they add value?
I have also stumbled across:
Model-View-ViewModel
Presentation Model
DataModel-View-ViewModel
Patterns in Prism (now known as the Composite Application Guidance for WPF)
I would love an active discussion on these above and those I may not have discovered yet.
Another pattern that we have used and loved is the Attached Behavior pattern ... using the extensibility mechanism of attached properties in WPF. There are quite a few posts out there on this useful pattern as well.
http://blogs.msdn.com/johngossman/archive/2008/05/16/attachedbehavior-pattern-sample.aspx
http://blogs.msdn.com/johngossman/archive/2008/05/07/the-attached-behavior-pattern.aspx
http://blogs.msdn.com/dancre/archive/2006/03/04/543854.aspx
http://www.codeproject.com/KB/WPF/AttachedBehaviors.aspx
I have been using a variation of the Model-View-Presenter pattern. It has served our purposes pretty well developing various UIs. It is not perfect but it gets the job done well. One of the issues I've had is that I am never satisfied with multi-threaded scenarios. We've recently been making many of our presenters multi-threaded. Since these worker threads, in the end, update the UI, we have had to dispatch actions to the UI through the View's dispatcher. Code was becoming really verbose if every View property checked the dispatcher so because of time constraints, we ended up exposing the View's dispatcher to the Presenter. Not the greatest move if you ask me...
We are using a modular UI framework similar to CAB and Prism, so a lot of those patterns apply to us as well.
I am also a big fan of Commands in WPF. I haven't been able to play around with Prism's DelegateCommand and CompositeCommand yet, but they sound really nice.
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 4 years ago.
Improve this question
I am developing a mid-size application with VB2008. To better test my application I am following a MVP/Supervising Controller approach.
My question is: What are your recommendations to separate responsibilites? So far I've come up with a winform with an instance of a controller and with an instance of my class. The controls are updated via DataBinding
The problem is that I'm just not sure where to write the responsibilites (let's say Validation, Report creation, Queries and so on) Inside my class? in a separate class?
Is there any small example of a clean Winform class design that you could point me?
I would suggest you spend time reading Jeremy Millers 'Build your own CAB' series of posts to get a feel for what you might like/need to implement as your application becomes more complex.
Martin Fowler is a good source of information on all things design patterns including MVC. Fowler discusses Passive View and separation of responsibilities is demonstrated also
http://martinfowler.com/eaaDev/ModelViewPresenter.html