L
lisa
I have a custom control that contains a collection. The collection is
of another custom control.
I can edit the child controls in a regular collection editor thing
without problem. But when I do, any properties I change result in the
new property being applied both to the child and to the parent control.
And it doesn't seem to make any sense. I have this in the parent
control:
<Browsable(False)> _
Public ReadOnly Property BackColor() As System.Drawing.Color
Get
Return System.Drawing.Color.Empty
End Get
End Property 'BackColor
And I have this in the child control:
<Browsable(True), NotifyParentProperty(False)> _
Public Property BackColor() As System.Drawing.Color
Get
Return _backColor
End Get
Set(ByVal Value As System.Drawing.Color)
_backColor = Value
End Set
End Property 'BackColor
I don't even want the parent control to *have* a BackColor property.
But when I set the BackColor on one of the children, that same property
is applied to the parent. It doesn't render, because of the Return
Color.Empty, but it's there in the aspx page. And since the same thing
happens with Enabled, which I *do* want working on both the parent and
the children, this is a real problem.
I tried adding the NotifyParentProperty(False) attribute, thinking that
it would prevent this from happening. It didn't.
Has anyone else run into something like this? Is there any way to stop
it from happening?
Thanks,
Lisa
of another custom control.
I can edit the child controls in a regular collection editor thing
without problem. But when I do, any properties I change result in the
new property being applied both to the child and to the parent control.
And it doesn't seem to make any sense. I have this in the parent
control:
<Browsable(False)> _
Public ReadOnly Property BackColor() As System.Drawing.Color
Get
Return System.Drawing.Color.Empty
End Get
End Property 'BackColor
And I have this in the child control:
<Browsable(True), NotifyParentProperty(False)> _
Public Property BackColor() As System.Drawing.Color
Get
Return _backColor
End Get
Set(ByVal Value As System.Drawing.Color)
_backColor = Value
End Set
End Property 'BackColor
I don't even want the parent control to *have* a BackColor property.
But when I set the BackColor on one of the children, that same property
is applied to the parent. It doesn't render, because of the Return
Color.Empty, but it's there in the aspx page. And since the same thing
happens with Enabled, which I *do* want working on both the parent and
the children, this is a real problem.
I tried adding the NotifyParentProperty(False) attribute, thinking that
it would prevent this from happening. It didn't.
Has anyone else run into something like this? Is there any way to stop
it from happening?
Thanks,
Lisa