aly
aly

Reputation: 483

Using MVP with Windows.Forms - presenter

I have a question on implementing the MVP pattern in a Windows.Forms application. I have a user control which is used from 2 different forms.

Basically, where shall the presenter be declared (and shall I have 2 different presenters for each form, not a single one for the user control, it be able to distinguish itself what kind of behaviour to take, depending on the form using it) - in the code behind of the user control or of the form using it ? The behaviour (logic on save and filling the fields of the user control) is quite different.

Thank You!

Upvotes: 0

Views: 427

Answers (1)

NileshChauhan
NileshChauhan

Reputation: 5569

One presentation can have multiple views. e.g. A list of dirs and files in a treeview or in a listview or anything else.

So One Presenter can satisfy the needs of multiple Views.

A View can have extra logic around how to present(convert to relative UI) the information provided by Presenter.

Each View can privately instantiate Presenter. Also because both the view are different UI representation of same presentation, they can should be extracted into a common interface (IXXXView) which can be than be passed into the Presenter.

imo, Passive Views are very strict about converting the data into primitive datatypes which can than be hooked to UI, using a Supervising View would give greater flexibility.

Upvotes: 1

Related Questions