I'm working on a windows WPF application using MVVM Light. As far as for switching views and navigation purposes, is there set classes readily available?
Right now, I'm using a MainViewController to load other views with datatemplate and messenger class. But i'm not sure if its the best practice.
Meant for switching is ContentControl but it has nothing to do with MVVM Light. Based on its Content you can assign diffrent Views. Take a look here.
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.
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 :)
Can somebody help me understand what the real difference is and why the MVVM Light toolkit users UserControl's for Views instead of Pages? I know there are some inherient differences between UserControl's and pages like access to the "NavigationService" on a page.
And some of the examples from John Papa's implementation of the MVVM Light use Page instead UserControl, but if you use the MVVM Light "View" Template it uses a UserControl.
thanks
dbl
A Page within a Silverlight application is designed to be hosted within a Frame - and is part of the navigation framework (see the MSDN Navigation Overview documentation). Applications of this style navigate from page to page, with the URL updating to reflect the current location, in much the same way as HTML-based websites.
A UserControl, is a re-useable unit of your user-interface. It is typically composed of a number of controls, UI elements - and may have some code-behind to perform logic.
If MVVM Light used Pages instead of UserControls, the framework would only be useful for navigation-based Silverlight applications, which are not terribly popular. However, UserControls can be hosted inside any other Panel or Page, therefore this approach is more flexible. A UserControl can be used as the content of a Page, but can also be used in many other contexts.
Specifically in MVVM Light toolkit? I've not dove into the Prism code yet to see what it does in regard to regions in a WPF UI. Seems like with the messaging and the ViewModelLocator in MVVM Light you could do a similar thing....Can you? Can anyone give some examples on how you could do this? Essentially I'd like to click on a button and load two different view models into the UI. Perhaps a better way to explain is Outlook-like Navigation Pane functionality.
This can be done fairly easily in WPF, without any framework.
Just setup a DataTemplate in your Application (or at the Window/UserControl level) that maps the ViewModel to the View you wish to display for that ViewModel.
You can then just use a ContentPresenter, and bind it's contents to a single property (which can be of type object) within your ViewModel. When you want to set the "region" to a specific View, just set the property to the appropriate ViewModel, and WPF will automatically wire up everything for you.
Which technology (WPF or Winforms) should be used if UI supposed to be highly customizable like controls layout/design could be change by user and such sort of UI customization.
Kindly mention best practices along to achieve that...
I just recently developed a designer in both WinForms (company req) and WPF (to see how much better it was). WPF has a definate edge, especially when it comes to nicer looking controls and control transparency.
This was my first actual WPF project, other than just messing around, so I was learning as I went. I found this series on creating a diagram designer very helpful. I didn't really do the same things that this article talks about, but more of a hybrid between that and my WinForms app.
I have to admit that the UI functionality was up and running much faster in the WPF version than with the WinForms version.
WPF I have found the easiest to create controls on a fly. Because I can just attach them as child controls to the parent, and the Grids, Dock Panels, just make life easier.
I found WinForms to be clunky to always work with. However I come from a Web background and Xaml makes sense to me.
WPF controls are design and lookless. That means you have a default view of them, but everything detail of a WPF control can be overridden. It's almost akin to using CSS. In the WPF world, you do not create custom controls like you do in WinForms. The main thing in WPF world is "styling" controls and defining a style for them. It just happens that the style also controls the layout and the form of the controls.
WPF is FAR superior for designing and style of UI. Check out these two top WPF companies and tell me if this stuff is easy to do in WinForms:
Cynergy Systems: http://www.cynergysystems.com/
Thirteen23: http://www.thirteen23.com/