Create a user control V.3 with a template and a user control v.3 with a template
Refactored this article "create a user control with template V.2" http://www.cnblogs.com/insus/p/4164149.html let other dynamic implementation header, Item and Footer.
Insus. NET does not want all code to be written in the switch shunting in the InstantiateIn (Control container) method. In fact, we want to use the Mediator of the Development and Design Model to split it.
Split into four methods:
ListItemType. Header:
ListItemType. Item:
ListItemType. AlternatingItem:
ListItemType. Footer:
In the above four templates, to enable dynamic columns or customize some programs, all the PlaceHolder containers are entrusted with the DataBinding event. Item and AlternatingItem share one:
OK. Now you can implement the intermediary class:
Now you can modify the switch program, which is the first image sample code in this article:
Running result:
Source code download:
Http://download.cnblogs.com/insus/Refactoring/ref_mediator_repeater.rar