As I write a WPF application with MVVM Light, I'm trying to determine the best way to allow for Navigation in the application. I've been reading about creating Services, Interfaces, and Helpers, but unfortunately my head still hasn't grasped the great advice being offered on SO. I got down a spiral of starting with a simple class and some code behind to use MEF and/or Unity to accomplish my task.
What do you find to be the simplest way to add basic Navigation of a frame to an MVVM Light application built on WPF?
The problem seems light, but it's hard. The solution must cover several aspects as navigating to an existing view, closing a view, injecting the viewmodel before navigating to the view, animated transitions, etc.
Please check out Magellan a WPF framework created by Paul Stovell that covers all this issues and more!
A simple navigation mvvm-light navigation demo.
https://bitbucket.org/dbeattie/navdemo/src
Related
How do I use multiple windows in an WPF MVVM app?
I have a Main Window with a menu control that needs to open up new instances of the window each time the item it is selected. I need to be able to show windows next to each other, it is a requirement and not page or usercontrol navigation.
Does anyone have an example of doing this?
I've read it is not recommended UI design but it is the requirement I have to implement.
Actually I have this working by using the WindowManager from Caliburn.Micro which seems like an very excellent framework for this type of application. I did look into prism but it seems over complicated and Caliburn is very easy to understand which did meet the requirements. I looked into MVVM Light but the documentation is horrible and lacks examples and I don't have time to figure it out.
Not sure if this an appropriate forum for this, but I need some guidance from those who are further down the road than I am with WPF.
I've used Telerik Winform controls for a years and have mixed feelings about them. They look good, but they are deeply nested, have a steep learning curve, and sometimes don't perform the best. For example, just working with a RadWindow in the WPF designer, it's slow compared with native wpf controls.
I like Caliburn.Micro MVVM framework and MahApps metro styles, but to keep the same look and feel for a ribbon bar I'd need to use another third party tool (like Fluent) or just use the Microsoft Ribbon View control and figure out how to use templates and styles myself (or find an existing metro template for it).
I tried to combine Telerik and Caliburn but had trouble getting them to work. There is a Caliburn Telerik library but its based on Caliburn Micro 1.5.2 and I'm trying to use Caliburn.Micro 2.0.2. Problem is I always get an aero-looking full window title bar and frame wrapped around the Telerik styled window.
I just don't know enough about conventions and such to make it all work together. And frankly, not sure it's worth the trouble. I'm looking for a more streamlined approach that lessens my dependence on pricy and heavy third party controls.
So, I'm looking for guidance on whether I should use straight Telerik, straight caliburn or go through the work of trying to get them to work together.
What I would prefer is to use Caliburn as the mvvm framework with a layer of styling, like what MahhAps provides. And for those controls that aren't styled, like the Ribbon Bar, to either use Microsoft's ribbon bar and find templates and styles that would work or maybe a 3rd party control like Fluent. But would I be getting in over my head in trying to learn templates and styles?
Sorry for the ramble, but I'm frustrated and need some help in working through this. Thanks.
I found a great resource that maybe others new to WPF and struggling with similar questions would benefit from: MarkPad, a Code52 project on CodePlex.
It's written in WPF using Caliburn Micro MVVM framework (although it's version 1.5.2 rather than the current 2.0) and MahApps metro styles with some "roll your own" windows. It's a great looking app with the kind of simple menuing system I was looking for AND an MDI implementation. It's also a good example on how to organize a somewhat complex WPF application, something I was also unsure about.
It answers the question: Do I need to use Telerik? The answer is a definite NO. It's a great learning tool for me and maybe will be useful to others.
I am new to WPF and MVVM and am working on an application which has a few views. Right now I have a View(HomePageView) shown in the shellView's context. Now using a button in the HomePageView I want to load another View in place of the currently shown HomePageView. After looking it up on google, I found something about Event Aggregators. I would request someone to explain the implementation or direct to a good sample application.
If your new to WPF MVVM I'd suggest first picking a decent helper tool
There are quite a few options. MVVM Light, Prism, MEF
I'd suggest MVVM light. Simple and easy to get up and running. Prism isnt solely a MVVM Helper but includes features to assist with MVVM. Not done much with MEF myself or things like Caliburn Micro.
As for a sample to explain how navigation between views work with MVVM Light try:
http://www.codeproject.com/Articles/323187/MVVMLight-Using-Two-Views
MVVM Light on CodePlex:
http://mvvmlight.codeplex.com/
^^ link has forwards to some video presentations totally worth watching
Another nice sample using MVVM Light:
http://apuntanotas.codeplex.com/
These should help you get started and you always got https://stackoverflow.com/questions/tagged/wpf for particular questions :)
What would be the preferred way of handling app screens in WPF (conforming to MVVM)? Silverlight suggeestions are also ok.
I'm not asking about app states (see MVVM Screen Management) but the actual mechanics of presenting various screens.
Do I implement screens as user controls? Pages?
Do I collapse and show controls or dynamically add and remove controls from main window?
How do I handle transitions (MenuToOptions, OptionsToMenu, GameToOptions etc.)?
The target app is a game but gamedev yielded no responses.
I would look into an MVVM framework such as Caliburn.Micro which has the concepts of Screens and Conductors. There are two Conductor implementations which come with Caliburn.Micro, or you can develop your own as required.
Rob talks about the concepts of Screens, Conductors, and Composition here.
The latest source also includes a GameLibrary sample which Rob discusses in his original Build Your Own MVVM Framework talk (EX15), which would be a good starting point.
I am developing a WPF desktop app for a small business. It will have a dashboard with 4 buttons that should show a corresponding window/form.
Examples -
Manage Entries
Admin
Reports
Help
Each of these has a separate form with lots of controls and stuff.
Is it best to have each of these as a separate window (including dashboard) and show them when a button is clicked in the dashboard?
Or is it possible to have just one window with these 4 buttons on top, and swap the contents below depending on the button?
I am kind of new to WPF apps so I don't know whats possible and what is the best-practice.
What you will find with WPF is nearly anything is possible from a UI perspective.
It is definitely possible having one window and swapping the contents below depending on the button. A pattern I like is PRISM which has some interesting patterns and best practices on achieving composite windows in both WPF and Silverlight.
You could also look at the MVVM pattern, which is becoming really popular with WPF. Josh Smith has many great articles for this.
Also, if you are really new, have a look as User Controls, as this allows you to easily modularize certain sections.
What I found with myself was with my first few WPF applications, I approached it from a Winform's mindset - but then after really getting a second look at Binding, these other patterns really began to shine.
One best-practice approach is to use Composite Application Guidance. Basically it is an application design approach which contains a shell and multiple views which are arranged inside it. Microsoft has released a CAG library called Prism through CodePlex, and has provided tutorials and documentation for it on MSDN.
CodePlex Link: Composite WPF and Silverlight
MSDN Link: Composite Client Application Guidance