Dynamic Property Array in Form Designer

S

screamingtarget

I'm using C# 2.0. I have a UserControl-based class that contains a set
of controls that are TextBox-based. The number of controls defaults to
1, but it is a browsable property (NumFields) in the form designer and
can be changed.

I expose a FieldText property in the form designer without exposing the
TextBox-based class. I'm using an array of strings as the FieldText
property. However the FieldText property as displayed in form designer
'Properties' pane does not change as I change the NumFields property,
even though I change the underlying string array when the number of
fields changes.

Is there a way to trigger the 'Properties' pane in the form designer to
update a property when another property has changed?

By the way, I get a CA1819 warning because I'm exposing an array as a
property, but this is the only method that behaves the way I want in
the form designer. If there's a better way to expose an indexed
property, but still have it appear as a tree node in the 'Properties'
pane, please let me know.
 
S

screamingtarget

I figured it out. Just needed "[RefreshProperties(
RefreshProperties.All )]" for my NumFields property.
 

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

Top