【使い方】
例:プロパティ「Pages」に設定したカスタムコレクション(CustomCollection)を永続化する。
/// <summary>
/// カスタムコントロールクラス。
/// </summary>
[ParseChildren(true),
ToolboxData("<{0}:TabControl runat=server></{0}:TabControl>")]
public class TabControl : System.Web.UI.WebControls.WebControl
{
・・・・・・
private myCustomCollection1 = new CustomCollection1();
private myCustomCollection2 = new CustomCollection2();
・・・・・・
/// <summary>
/// カスタムコレクション1を表すオブジェクトを取得します。
/// </summary>
[MergableProperty(false),
PersistenceMode(PersistenceMode.InnerProperty),
Description("カスタムコレクション1を表すオブジェクトを取得します。"), Category("データ")]
public CustomCollection1 Items1
{
get {return myCustomCollection1;}
}
/// <summary>
/// カスタムコレクション2を表すオブジェクトを取得します。
/// </summary>
[MergableProperty(false),
PersistenceMode(PersistenceMode.InnerProperty),
Description("カスタムコレクション2を表すオブジェクトを取得します。"), Category("データ")]
public CustomCollection2 Items2
{
get {return myCustomCollection2;}
}
・・・・・・
}
|