Child property changes copied to parent?

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
 
L

lisa

I'm sorry, this was posted to the wrong newsgroup. My apologies.
Followups set to
microsoft.public.dotnet.framework.aspnet.buildingcontrols.

Lisa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top