I am new to WPF/MVVM and I need to create a single application window.
To clarify, I would like to have a single window with a basic menu, which, depending on the option clicked on that page/window, launches a completely new set of controllers within the same window (completely replacing the menu interface).
Basically, I'd like to be able to replace the content of the menu window, with the content of new user interface, and then to be able to go back to the menu interface again later.
Any directions? Thanks.
PRISM Navigation is the way to go. You can read about PRISM Navigation on MSDN. It provides a good explanation with a lot of code samples. Karl Shifflett also has a couple good blog posts here and here which are helpful.
Related
I'm new to using MVVM Cross and I'm trying to get the basics. My confusion comes in with seeing my view. I have a main view that is a menu bar with a few menu items with a different color background. That is my main view. I've watched a few videos online and study the tip calculator example, but none of those really point to how the view "shows" when the application runs. It seems a bit magical. So I know I'm missing something.
Now what I did figure out is if I use the ViewPresenter attributes, I can get my main view to display over the main window. But, without those attributes, all I get is the main window. The tip calculator example does not show any attributes so again I think I'm missing something. Any help would greatly be appreciated.
Thanks.
MvxApplication.RegisterAppStart<TViewModel>() in the Core project is telling MvvmCross the ViewModel to start with. MvvmCross can use convention to find the view for the ViewModel, or the more modern approach would be to use the view presenter attributes. TipCalc was written before the view presenter attributes and has not been upgraded to use them.
There is general documentation about view presenters here. Each platform has specifics.
For example, Android has activity + fragments. Activity is like a window. Fragment is like a user control. MvvmCross would automatically create the host activity for your fragment as needed when you use the IMvxNavigationService to navigate to your fragment ViewModel. There is more information avaiable in the MvvmCross documentation.
I've searched all over but it seems like no one has figured out a way (or at least written about a way) to add transitions to a ContentControl (or equivalent) in Silverlight for Windows Phone.
I'm using Caliburn Micro, and I have a Screen Conductor that activates different user controls. All I want is a simple slide effect between activations, forward and back. You can do this in WPF but not in SL4WP it seems like.
The other alternative is to switch to using navigation between these views, but then I lose the "master-detail" style view model. I'd be open to an answer that kept my intention but used page navigation instead (since then I could use the Slide transitions from the Windows Phone Toolkit).
It's a step-by-step style conductor, I need to lead the user through a 2-3 step process, allowing them to go back or cancel out, each step using data from the previous.
Are you sure it cannot be done? There are various blog posts and articles on the internet that indicate that the TransitioningContentControl is part of the Silverlight for Window Phone Toolkit.
Note that 'Silverlight' and 'Silverlight for Windows Phone' are different things, so you must download the right toolkit.
How do I transfer data from one window to another modal in silverlight. I have one window, push the button and another window appears where complements sample text boxes, data from these fields I would like to have seen in the previous window.
The answer depends on what type of framework you're using. In caliburn micro with a viewmodel first approach these types of things are very simple. You just create a new viewmodel and set the proper fields and let caliburn handle displaying it for you. With other view first approaches it is more difficult. You can maybe use a Message to set the fields using something like MVVM Light. Either way we need more information on how you are building your app to answer your question.
I'm trying to build an app in winforms with something similiar to masterpages in asp.net - a menu on top and when choosing an option from the menu the entire screen on the bottom will change while the menu remains (there are 10-15 screens in the future app, some are quite similar, some are not).
What is the best way of doing this? Should I use different forms for each screen or use a panel or something else?
If I use a panel or something how do I manage to use the designer with so many panels taking space on the screen?
Try with the MDIParent Form's. View the Example
http://www.codeproject.com/Articles/12514/Multi-Document-Interface-MDI-tab-page-browsing-wit
If it is just keeping the same menu and opening/closing parts of the UI you could simply add and remove instances of usercontrols to the main form.
If you need more features such as docking (like Visual Studio) look at this
Another option is to use Form inheritance
Which one to select depends on what you want to reuse and the features you need.
One option would be to make your application an MDI window and then load entire forms, maximized, into the parent window.
Then, you would be able to treat each form as its own self-contained item, since it really would be exactly that.
Is it not an option for you to use WPF? A WPF browser application fits the paradigm you are describing quite well.
I am writing my first wpf application now .
I want to use a NavigationWindow on each page the user make selections and all the data should be available on the next pages, I have about 6 page.
How I should path all the data ? via the constructor ? or there is some smarter way in WPF .
On the last page there will be a lot data to path from the previous pages.
I would attack this from one of two ways: The Code-behind way (Easy, but difficult to expand, also will get very messy), and the MVVM way (Takes some learning, separates concerns, easy to extend, manage).
In the code-behind way, I would just have a Tab control with the tab headers styled the way you want them (you can style them to look like just about anything you want). In the code-behind you could have some logic that specifies that X Tab is not enabled or Visible until Y criteria are met.
There is a better way, but it comes with a bit of a learning curve, the MVVM design pattern. You would have 6 Page objects that are really just CLR objects that define the contents of the page (e.g. if it is a questionnaire your page objects would contain question objects and title objects for instance).
You could have a couple of Views, a navigation View, and a page view. The NavigationView would be bound to a NavigationViewModel which would have the logic necessary to change the page. The PageView would be bound to one of 6 PageViewModels and the PageViews DataContext (which provides that binding) could be changed based on the NavigationViews logic.
Learning Prism composite application guidance for WPF Silverlight MVVM Fundamentals
MSDN Page for MVVM explanation
Night Walker,
It is difficult to make out exactly what you want to do from your explanation. First, the NavigationWindow is the frame of your application, I think you know this but I just wanted to make sure we understood that we're not creating new instances of the NavigationWindow. I think you mean 'Pages'. Pages are the content of a Navigation window and represent some target that you want to appear in the ContentPresenter that is provided by the NavigationWindow.
I'm again not sure how you are using the phrase 'Path the data'. Typically you would create Pages either directly in the project or in satellite projects and then reference them using Pack URIs. An example of how Pack URIs are constructed can be found here.
http://msdn.microsoft.com/en-us/library/aa970069(v=vs.85).aspx
You can then navigate to the pack URLs using an expression that looks like:
this.Navigate(new Uri("pack://application:,,,/MyAssembly;component/MyPage.xaml", UriKind.Absolute);
If you don't want to get involved with all the nuts-and-bolts of the framework for navigation and just want to focus on the application for your users, you can check out the professional version of the NavigationControl that I put together:
http://www.teraque.com/products/explorer-chrome-suite/
There's an free demo you can download. If this is was you are looking to do I can give you pointers if you don't want to purchase the package directly.
Sincerely,
Donald Roy Airey
donald.roy.airey#teraque.com