470,870 Members | 1,411 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,870 developers. It's quick & easy.

Easier way to expose properties?

ljh
I am using some 3rd party controls to create my own control.

I want to "pass up" many (but not all) of the properties of the 3rd party
controls that I am using to make my control, so that the end user can
customize as much or as little as they wish. But, there are HUNDREDS of
properties (of the combined controls).

Is there an easy way to expose the properties of the controls that I am
using to make my control adn still be able to block the very few properties
that (if set wrong) may make my control act up?

May 21 '06 #1
2 956
The first solution (politically correct) would be to provide accessors
to all the interested properties. The second solution (also politcially
correct) would be to subclass the original component and hide the
properties you don't want.

There is also a third solution, but it's a bit hackish ... By using
reflection you can create a method SetProperty(string name, object
value) and set the values of the properties. There you can check for
properties you don't want to change.

Regards,
Tasos

May 21 '06 #2
what is wrong with

myComponent.MySubComponent.Property = newValue;

This way you do not need to program the properties again.
There also might be tools/codegenerators which might be able to automatize
the generation of properties for you. If not, you can easily generate a code
generator by yourself using reflection.

--
"ljh" <So**@where.else> schrieb im Newsbeitrag
news:_x*******************@bignews8.bellsouth.net. ..
I am using some 3rd party controls to create my own control.

I want to "pass up" many (but not all) of the properties of the 3rd party
controls that I am using to make my control, so that the end user can
customize as much or as little as they wish. But, there are HUNDREDS of
properties (of the combined controls).

Is there an easy way to expose the properties of the controls that I am
using to make my control adn still be able to block the very few
properties that (if set wrong) may make my control act up?


May 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Prigozhin Roman | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.