View Presenter model with multiple views (or layered views) in C #

I have a split container in the left pane - this is a user control with buttons. On the right panel is the initial user control, which will change depending on which button is pressed. What I want to know is how can I let the Spilled Panel Form know to draw as x from the main view of the button?

+4
source share
1 answer

Theoretically, Presenter should have access to the views, in which case the Presenter should be notified of any button clicks from the view in the left pane, and then update the form to display the view in the right pane.

How exactly this is achieved depends largely on your specific implementation. Architectural patterns are recommendations ... there are no hard and fast rules to follow (if you do not use any MVP library, in this case you will be limited to the implementation of this library).

EDIT: To answer your question below, Chip ...

Again, this is entirely up to your implementation. In some cases, it may make sense to have one massive Presenter and dozens of opinions. In other cases, it may make sense to have one lead for each performance. However, even if you have several presenters, you still need to maintain a hierarchy so that the facilitators can talk to each other. Thus, somewhere at some level, the leader should know both the click of a button and the empty container waiting to be filled, even if this knowledge indirectly occurs through another leader.

EDIT 2: (In response to your updated comment) There are no hard and fast rules, but one common feature among MVP implementations is that Presenter retains at least partial control. This means that the Presenter must have some level of access to all relevant user interface elements. If you insert views in the views, you still need to develop a way in which Presenter can interact with them.

+7
source

All Articles