Composite UI, the designer and IoC

time to read 2 min | 258 words


I am trying to think of a way to make this view work. It is a single view that contains more views, each of them responsible for a subset of the functionality in the view. This is the first time that I am dealing with smart client architecture for a long time.

It is surprising to see how much the web affect my thinking. I am having trouble dealing with the stateful nature of things.

Anyway, the problem that I have here is that I want to have a controller with the following constructor:

public class AccountController
	public AccountController(
		ICalendarView calendarView,
		ISummaryView summaryView,
		IActionView actionView)	{ }

The problem is that those views are embedded inside a parent view. And since those sub views are both views and controls inside the parent view, I can't think of a good way to deal with both of them at once.

I think that I am relying on the designer more than is healthy for me. I know how to solve the issue, break those into three views and build them at runtime, I just... hesitate before doing this. Although I am not really sure why.

Another option is to register the view instances when the parent view loads, but that means that the parent view has to know about the IoC container, and that makes me more uncomfortable.

It is a bit more of a problem when I consider that there are two associated calendar views, which compose a single view.

Interesting problem.