inherited properties in userControl

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

OK, so i searched this forum, and it seems like my question has come close to
being answered a dozen times, but never fully...
I have a very simple control that inherits from UserControl. It has no
child controls, just properties and custom drawing. I would like one of
these properties to be 'Text'.
So i setup a private _Text field (base.Text not accessible) and public
String Text property. I have tried using both 'override' and 'new' keywords,
but the results appear to be the same, which is limited access to the Text
property when trying to use the control on a Designer form. The best I can
do is to get the property to show up in the IDE property window, but nothing
else. I can set the Text in the property window, but the Form Designer does
not generate the corresponding code to set the property, so when I run my
project, the Text i set has reverted back to the default text. I can
manually go into the designer code and put the line in myself, run the
project, and everything works as expected. If i do the same, but then go
back to the designer and change the Text in the property window, the code i
just inserted gets erased.
I'm assuming this an inheritance issue, since all my other non-inherited
properties exhibit the expected behavior. This seems like it should be an
easy answer, but it's got me frustrated. Is there another issue here, like
the fact that the text property comes from 3 levels of inheritance down? I
know I could probably avoid all this by just changing the property name, but
I'd like to stick with the commonality theme if at all possible.
Thanks in advance,
Joe
 
I had previously tried setting Browsable and EditorBrowsable..
DesignerSerializationVisibility and Bindable must have did the trick, cause
it works now. Thanks Tom
 
Back
Top