G
Guest
Hi All,
I am building a WinForm User Control which, among other things as a
DataSource and DataMember property...much like the Data Grid. All works fine
as far as setting these properties in the Property Grid and persisting them
for both the Runtime and Design Time.
However, when the host form is displayed in the design-time, I would like to
use these properties to populate the control with sample data. When the
user/developer changes either property, the code displays the sample data and
all is well. However, when the control is displayed in design time after
being newly openned or after the host application has been run, the
serialized property is not available to display the sample data. I have
tried accessing them during control initialization, the usercontrol Load
event and the UserControl Invalidated event with no luck.
Is there an accessible event that is fired after persisted properties are
restored?
Is there an error in my property attributes that may be causing the problem?
(Code is listed below for these two properties)
Any help would be greatly appreciated.
Dave
*************************************************
Code Below
*************************************************
<TypeConverter("System.Windows.Forms.Design.DataSourceConverter,
System.Design"), _
Editor("System.Windows.Forms.Design.DataSourceEditor,
System.Design", _
GetType(System.Drawing.Design.UITypeEditor)), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
Public Property DataSource() As Object
Get
Return mDataSource
End Get
Set(ByVal Value As Object)
mDataSource = Value
SetDataSource(Value)
SetUpColHeaders()
End Set
End Property
<Editor("System.Windows.Forms.Design.DataMemberListEditor,System.Design", _
GetType(System.Drawing.Design.UITypeEditor)), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
Public Property DataMember() As String
Get
Return mDataMember
End Get
Set(ByVal Value As String)
mDataMember = Value
If Not mDataSource Is Nothing Then
SetDataSource(mDataSource)
SetUpColHeaders()
End If
End Set
End Property
I am building a WinForm User Control which, among other things as a
DataSource and DataMember property...much like the Data Grid. All works fine
as far as setting these properties in the Property Grid and persisting them
for both the Runtime and Design Time.
However, when the host form is displayed in the design-time, I would like to
use these properties to populate the control with sample data. When the
user/developer changes either property, the code displays the sample data and
all is well. However, when the control is displayed in design time after
being newly openned or after the host application has been run, the
serialized property is not available to display the sample data. I have
tried accessing them during control initialization, the usercontrol Load
event and the UserControl Invalidated event with no luck.
Is there an accessible event that is fired after persisted properties are
restored?
Is there an error in my property attributes that may be causing the problem?
(Code is listed below for these two properties)
Any help would be greatly appreciated.
Dave
*************************************************
Code Below
*************************************************
<TypeConverter("System.Windows.Forms.Design.DataSourceConverter,
System.Design"), _
Editor("System.Windows.Forms.Design.DataSourceEditor,
System.Design", _
GetType(System.Drawing.Design.UITypeEditor)), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
Public Property DataSource() As Object
Get
Return mDataSource
End Get
Set(ByVal Value As Object)
mDataSource = Value
SetDataSource(Value)
SetUpColHeaders()
End Set
End Property
<Editor("System.Windows.Forms.Design.DataMemberListEditor,System.Design", _
GetType(System.Drawing.Design.UITypeEditor)), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
Public Property DataMember() As String
Get
Return mDataMember
End Get
Set(ByVal Value As String)
mDataMember = Value
If Not mDataSource Is Nothing Then
SetDataSource(mDataSource)
SetUpColHeaders()
End If
End Set
End Property