migueldeicaza/MonoTouch.Dialog — pull request #167 by rkamphorst (2012-12-08 16:18:49+00:00)
Title: Two changes to Reflection API: (1) to make it extensible with new Elements, and (2) to access rendered Elements from a callback 

In our project we use the Reflection API extensively to construct the views, primarily because we need to be able to restructure the app flow frequently, and add new elements and remove obsolete ones.

We use a version of MD with the following modifications. I have permission to give back to the community, so here we go ;-). Note: Both changes come with documentation and sample in the sample app.

#### Change 1: CustomElementAttribute

We need to show some specialized elements in our views. Instead of maintaining a copy of MD with a BindingContext that knows all these elements, I added the CustomElementAttribute that allows custom attributes to be defined for any element and to be used in the Reflection API. I see there is already a pull request that aims to do the same (#66); however, imo our solution is a bit more flexible, for example it allows for elements from "Element collections" from different sources to be easily mixed in one app.

#### Change 2: IndexTagsAttribute

The other change we made is the IndexTagsAttribute; it creates a way to access Element instances from the BindingContext after it has reflected on the view model. Indirectly, it also creates a way of attaching to events other than StringElement.Tapped (via [OnTap]).