App screens management in WPF - wpf

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.

Related

WPF Modules in a Apps View

I am in the early stages of designing a WPF MVVM application. I will have several modules in my application and will be adding more in the future. I want the home screen to feel almost like that of a tablet with the modules displayed as icons similar to apps on a tablet. I was looking for some advise on what WPF control would best help me get this desired look and feel. I would some advice on this and if anyone has a link to an example where some else has implemented something similar
I would suggest first you go and see how Prism framework works for a modular wpf application (one of the best architectures)
Secondly, your UI should be a hardcoded main screen with the tile icons for each module or wrappanel in itemscontrol with datatemplate defined as a tile. Also you can check this sample oriented in WinRT lookalike GUI.

MVVM-Light/WPF Navigation Application

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

I need to find a common architecture for wpf and web forms

My shop is moving towards re-working the app to be a combination of WPF and web forms.
Some functionality will be facing the public via web forms and some will be internal only via WPF. I'm trying to find a common architecture for both sides of the equation. From what I've seen so far MVVM is the best bet for the WPF side, but that doesn't seem to apply as well to web forms.
Update:
Thanks for the replies.
"why can't you have two very different
architectures? Web Forms and Win Forms
or WPF and Silverlight."
Microsoft announced awhile back that there would be no new development in WinForms so it doesn't make any sense to go that route.
The reason for the common architecture (if possible) if so we don't have 2 different code bases/knowledge bases etc etc.
The app is very much LOB (line of business) with heavy use of grids and data entry forms etc etc. I know when WPF initially came on the scene there wasn't much in terms of data controls (such as no data grid) but WPF now has controls via Telerik (sp?) and others including Microsoft itself had been leaning toward webForms for same reason.
What's the status regarding Silverlight at this point in time?
There is Prism. Prism is designed to help you more easily build modular Windows Presentation Foundation (WPF) and Silverlight client applications. These types of applications typically feature multiple screens, rich, flexible user interaction and data visualization, and role-determined behavior. They are "built to last" and "built for change."
Here's a good design on CodePlex.
alt text http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=LayerSample&DownloadId=129253
Since you have picked to very different presentation platforms why can't you have two very different architectures? Web Forms and Win Forms or WPF and Silverlight.

What is a good UI approach for a WPF dash-board-with-several-windows kind of application?

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

Sample WPF apps for line of business apps?

I am learning WPF and wanted to look at source code to some good full fledged WPF apps which are used for business apps, data binding using data bound controls like grids and good use of WPF design and patterns.
Not interested in WPF apps which show off WPF's graphics capabilities. Yes I am into your typical boring business apps. Also looking further than codeproject.com. If you know something good at CodePlex, a pointer would be helpful.
Any recommendations?
CodeProject.com is a very good resource for finding examples of .NET applications. Some articles are at a "here's a control, here are some example usages", but there are the occasional full-fledged app write-ups too.
Here are a couple of examples of some business-y WPF usage which may fill your needs:
WPF Business Application Series Part
1 of n By Karl Shifflett
WPF DataGrid Practical Examples By
Colin Eberhardt
Binding and using Friendly enums in
WPF By Sacha Barber
You can find many more in the WPF section.
The Patterns and Practices group at Microsoft has published a Composite Application "guidance" that is code-named Prism. It includes a demo stock-trading app and source code with examples of various design patterns. It's here on Codeplex.

Resources