I have a form with some views that I’ve surfaced in a tabbed interface through the use of a content control. The content control makes tasks like these super easy, but it comes at a price.
The content control makes quick and easy work of displaying a form within another form or view, making it ideal for displaying content within tabbed interfaces.
But because the control works by pointing to a URL, there’s actually no relationship between the form or view the control is on and the content you’re displaying.
An example: say you have a rule on the host form (the one with the content control) that says if the tab is clicked, configure the content control to point to the URL of your content form. (Check out my ultra-cheesy Paint image below).
Now let’s say you want to modify that rule to tell it to call the Initialize() method of the content form (CF) or it’s views (CV). You can’t — because CF isn’t actually associated in any way with the host form (HF). That content control could be pointing to CNN.com — HF doesn’t care where the thing is pointed. HF can’t listen for events in CF, and you can’t drive actions in CF from HF.
So if you’re using a content control, keep in mind its contract with your content is to display it. Nothing more. If you’re going to want the host form to have access to the content form or its elements, the content control might not be the way to go.
You must be logged in to post a comment.