I am new to WPF. I want to know if there any feature exists in WPF using which, we can generate auto UI for CRUD operation using entity framework as we do in Asp.Net MVC?
No there is not such built-in feature in WPF. But you can use DataTemplates, ControlTemplates and User interface patterns such as MVVM and MVP to implement your own library to do that.
Related
In many ways I think of using the MVC pattern in WinForms, but I'd like to know if it's possible to bind controls with objects using the ObservableCollection type? If it's purely for WPF, what other alternatives are out there?
To put it into perspective, we're building a system which has business logic that I'd like to control the UI with, instead of making customizations for each requirement or workflow on the UI itself. We have around a few hundred potential forms which I'd like to start designing with the pattern in mind.
We're also building web interfaces for most of the processes, but in reality they're just watered-down versions of the Forms. If I can use the same framework which I can just bind to on the web form that would be awesome.
Thanks
What ObservableCollection does is that it implements INotifyPropertyChange and each control in WPF has the possibility to listen for it's bound data to raise the event from INotifyPropertyChange. You can read more here about why you can't use ObservableCollection they way you want to in WinForms.
Another way is to use the Model-View-Presenter pattern:
This pattern can also be used in ASP.NET.
There's an MSDN Magazine Article on: "Better Web Forms with the MVP Pattern" that I think you should look into. And here is an introduction to how you use MVP-pattern in asp.net.
I have a Silverlight class library which is a model in my MVVM app. I am using MVVM Light. How easy is it reuse that model in a WPF app and use the MVVM Light framework. The framework has different dlls for WPF and Silverlight so I guess there is incompatability of sorts. I was wondering if anyone could talk me through the options. Cheers, Chris.
The suggested option is to use the Project Linker, this tool synchronizes code over multiple projects, allowing you to maintain a Silverlight and WPF dll with one codebase.
I hope you mean model means data in WPF and Silverlight. If that is the case, you can expose the data using a Service. It can be any service like web service, WCF service or WCF RIA service. Since a service can be multi tenented you can have a Silverlight as well as WPF client accessing the same service.
If you are trying to share the ViewModels between Silverlight and WPF using MVVM light, I would suggest you have a look at the MIX 2011 video of the presentation by the creator of MVVMLight library Laurent Bugnion. This is called Deep Dive MVVM and is a very good session. In short you can share ViewModels between WPF and Silverlight by adding the file from one project to another as a "LINK".
Hope this helps
I am building a WPF application using the PRISM guidance, I want to use the Entity Framework 4 for a data repository.
I have previously developed a Silverlight app, using Prism and WCF RIA Services which worked great as all my components are decoupled.
So what is the best way of getting data in my WPF application in a decoupled way.
Thanks for any advise
You might have a look at the BookLibrary sample application of the WPF Application Framework (WAF). It shows how to use the Entity Framework in a WPF MVVM application. However, it's not PRISM.
Are there any MVC frameworks available for WPF other than Caliburn (which looks awesome btw)?
Both Caliburn and PRISM are very nice. However if you go down the path of MVC you will miss out on the powerful 2 way binding. Consider MVVM, it's a very clean and practical approach for WPF. This is the pattern Microsoft used for their expression blend.
There is also Magellan, a port of ASP.NET MVC for WPF.
There is Composite WPF aka PRISM from Microsoft Pattern & Practices.
http://www.codeplex.com/CompositeWPF
one additional possibility is pureMVC (www.puremvc.org)
it seems well-proven, has good short doc/UML, and the project is responsive, and has been ported to .NET - there exists an WPF demo, it will be published soon but you also can contact the project owner about it.
Regards,
Paul
A new MVC framework that works with practically and .net technology (WebForms, WinForms, WPF, Xamarin Forms) is SimpleMVC by Gateway Programming School. This link gives an overview and example usage.
A short example is to create a controller from SimpleControllerBase that has your business logic. This will depend on the SimpleModelBase implementations you provide. Implementations of ISimpleView are handled through WPF pages and controls. The derived controller only works with the interfaces that extend ISimpleView so that the WPF parts are abstracted away. You then use properties on the view to do two-way data-binding, just like MVVM, but with a proper layered architecture.
If we develop a winform app using an MVC architecture, it should not be too hard to change over to WPF at a later date, correct?
Well designed WPF application heavily leverage data-binding. As such, you might consider using classes such as ObservableCollection and others and implement IPropertyNotify when designing your model.
Look up some references to the M-V-VM pattern advocated by Microsoft product groups (e.g., Blend) for more information.
It seems that in Codeplex there is an MVC winform open souce fmwk for developping winforms app
That framework is koossery.MVCwin, located on Codeplex at http://koosserymvcwin.codeplex.com