Using Presentation Model with complex custom controls (which have their own models)

78 views Asked by At

I have an application which uses Martin Fowler's Presentation Model with WinForms (WPF would be a better choice, but that's irrelevant). As such, every view has a presentation model representing it where the UI logic and domain model translation logic reside. This works very well when the controls in my views are built-in .NET WinForms controls or third-party controls.

In subscribing to the DRY principal, I have a class library used by my application which provides a set of my own custom controls that are used in multiple views in my application; each of these controls is a composite of smaller controls that have some functional relationship. The custom controls also have their own presentation models that control their UI logic.

My question is, how can I architect my application so that the concerns of the view are not tied in with the underlying UI logic of my custom controls? Here is a diagram:

enter image description here

I don't want the flow of information from the form's presentation model to the control's presentation model to have to go through the views themselves; but at the same time, the presentation models don't know (nor should they know) about one another.

0

There are 0 answers