我有一个复合控件,它具有大量可用于设置控件样式的属性。我想对这些属性进行分组,但仍保留 ViewState 中的一些属性 控件的标记如下所示:
例如
<cc:Test id="test">
<Toolbar Items="add,delete" Enabled="true" />
<Grid Enabled="true" AllowSort="true" AllowFilter="true" />
</cc:Test>
我的代码看起来像这样
<ParseChildren(true)> <PersistChildren(true)> _
Public Class Test Inherits CompositeControl
Private _grid As New GridStyle();
<PersistenceMode(PersistenceMode.InnerProperty)> _
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
Public ReadOnly Property Grid As GridStyle
Get
Return _grid;
End Get
End Property
End Class
Public Class GridStyle
private _allowFilter As Boolean = False;
Public Property AllowFilter As Boolean
Get
Return _allowFilter
End Get
Set(value As Boolean)
_allowFilter = value
End Set
End Property
End Class
ViewState 无法从 GridStyle 类访问,那么我将如何维护 ViewState 中 AllowFilter 属性的状态?