I am creating an Application which will be a Tab based application having separate pages for each Tab. I want use RibbonTab as the Tab.
On selecting one RibbonTab corresponding UserControl will be loaded in the below section.
Each RibbonTab and each UserControl should behave like a pair.
First Challenge - It would be easy to use single ViewModel for each RibbonTab-UserControl pair. But how to share single ViewwModel in to separate view.
Second Challenge - What is best way to implement this application
One Ribbontab and One UserControl is already ready. Waiting for how to associate those two.
I'm not clear on the First challenge could you elaborate it please and I'll edit the answer.
As for the second challenge I highly recomend choosing a framework as that will make implementing MVVM a little easier Framework Comparison
I use a ContentControl and ResourceDictionary to determine what view to display based on the bound ViewModel as in this example. That technique could be used for the tab control as well here are a couple links on how to implement this:
Microsoft Tab Controled application Tutorial
Tab Control Binding
Related
I'm creating a web-site using GWT for the first time. The aplication has two Composite class, one of them is a menu and the other one is where I show de info about the specific menu that has been clicked. I'm using MVP, the class History and the interface ChangeValueHandler to switch among different pages.
I have one pair presenter-view for each Composite. The app begins well creating the menu and the section info. When you click in the menu it works fine showing the information and the token browser is changed. The thing is that if you load a page(eg: myapp.com#register) without loading the home page, it doesn't show you the menu. It loads the Composite section info, but not the Composite menu (the Composite menu is load with myapp.com#home).
I think it's because of a bad design of the application, but I don't know how to do that in other way. If the app only had one Composite it wouldn't be a problem, but when there are 2 or more Composite per page I don't know how to manage the whole thing to work properly.
It's difficult to tell what exactly is wrong, because of the lack of code. So I'm guessing. You should design to act on the PlaceChangeEvent instead of the ValueChangeEvent. That means a menu click should fire the place change and then the application will handle this event. That way you unbind the menu actions from your content pages. And think more of each page as a separate entity. Also take a look at the GWT Activity mechanism and how it helps having a main page that is always the same and on that main page a content area that changes depending on the page actually shown.
You should include your menu in each page instead of creating it once in the home page and then keeping it on screen. I assume you create the menu and add it to the DOM via
RootPanel.get().add(myMenuWidget);
If you are using UIBinder it should be pretty straightforward to include the menu in each page, just a matter of adding the corresponding tag in each .ui.xml file of your pages.
I am trying to navigate on a frame with pages but instead of giving views to the page I am giving view models.
This works fine, but the problem is when I navigate between the pages the status of the radio buttons for example doesn't stay the same. It stays only if I use the views and not the view models.
Any ideas?
Thanks.
Some code to explain how you navigate between each control would allow us to give you more specific answers, currently we can only guess what you are doing.
It sounds like you are creating a new instance of each ViewModel when you are navigating between pages. This of course means things such as radio buttons and control states will not remain consistent.
You could use a framework such as MVVM Light and make use of their ViewModelLocator pattern. This means you could have one static instance of each ViewModel.
You could also store all of these states in a simple data model, and then simply have your new ViewModel instance refer to this model and update it's check boxes etc appropriately.
i'm just learning GWT MVP design pattern for weeks. now, i'd like to use this design pattern on a large web application. this application is a web ordering system wherein it has a login page and a main page. in the main page, it has buttons and a TabLayoutPanel wherein each tab contains the web ordering step - Tab1: select item(s) Tab2: view cart Tab3: post order.
Each tab has lots of widgets that manipulates the ordering process. now, i need to ask your idea on
how to properly separate each tab manipulation which follows the MVP pattern?
You question is not a black or white one. It depends on what the logical units of the problem are and how much interaction is on each tab. If the tabs are the main navigation between logical units of your application, I would say have a presenter for each tab (which also means an activity mapper for that area) - There would also be an presenter activity mapper for the non tabbed regions of your app also. But if each tab is just aspects of the process, then it may all logically fit in an overall presenter. Given what you said about the process, that it is kind of like a order wizard, I would tend to go with one presenter for the whole tabbed area where the presenter contained all the ordering knowledge and knew which step it was on.
Hello I have a prism/mvvm style application and am using the RadMenu control. I also have a view/view model pair in one project and another view/view model pair for my RadMenu control in another project. Basically I would like to use the event aggregator to send an event to the view model for the RadMenu (the view model that is paired with the view that the RadMenu sits inside of). So that the RadMenu's view model can notify the RadMenu to switch to a different RadMenuItem programmatically. I think I can use a blend behavior to contain the behavior I'm looking to reproduce, but I cannot find a method in the RadMenu that will allow me to programmatically select a specific menu item.
If the control does not support this now, is there a work around? Thanks.
I believe this is a missunderstanding. As far as I know there is no selection on the RadMenu. You can only Check or Uncheck Items in your Menus. Are you trying to emulate a user clicking on a specific item just to trigger the functionality behind the menu-item? If that's the case I would propose another way and directly handle the EA-Message in the ViewModel. You can trigger the code from there then. If you're doing MVVM the logic behind the menu-items is implented in your VM anyways. :)
I'm trying to use the GWT Activity & Place model, but I'm having some
troubles with it about how to use my activities.
I've got a LoginActivity which drives the user to another activity :
DemandsActivity.
My DemandsActivity manages a view ("DemandsView") which displays a
simple list of demands (with a CellTable).
The whole works fine.
I would like to be able to show the details of a demand, from a
selected line of my cellTable, by displaying
a DialogBox with the informations.
I thought I could use one more
activity to do that : DemandDetailsActivity.
But I don't know how to do that.
Or I've been wrong from the beginning. Maybe should I put several presenters (displays) into my activity ? One presenter to display my CellTable, and another one to display a selected element of my CellTable in a DialogBox, without changing Place ?
What do you think of that ?
Thanks
What you are trying to do is called master-detail view. People have been implementing it with GWT, just google around.
On a side note: in MVP parlance Activities are presenters and Views are displays, so when you say put several presenters (displays) into my activity it really makes no sense.
Presenters should correspond to a place and handle business logic. They should not be concerned with the display part. And they should be testable, which means they should run on desktop/server JRE without GWT client dependencies.
So, all the GUI building part should be inside Views. And, yes, you could have multiple Views per Activity if this makes sense. BUt, personally, I'd go with one View that shows details (possibly dialog) when Activity instructs it to.
You should normally have a one to one relationship between Places and Activities but you may have many Views per a given Activity. In the project I'm currently working on we create an interface per Presenter and its associated View and then have our Activities implement any Presenters for the Views it needs to display.