Changing properties of inherited Infragistics controls

Posted by Tung on 31-Oct-2013 07:17

Hi

Can someone tell me if I've misunderstood how inheritance works for controls?

If I create a control myLabel that inherits from UltraLabel and change its text appearance to bold, the control has bold text when dropped onto a form. If I change my mind and want myLabel to be italic bold text and drop another one on a form, it has italic bold text. But the first myLabel still has bold text.

Is there a way of making the myLabel on all forms have the new bold italic text without manually changing every single one?

And of course we'd want to choose which properties are universal and which aren't, so one form might have labels in a different colour.

Tung

All Replies

Posted by bab on 01-Nov-2013 02:41

Hi Tung,

when your first time dropped myLabel  that time if you observed they is a code was generated some thing like this

in the above code the default value of font property is changed to Bold. hence it is serialize (code was generated) the modified property.

because of that in the second time when u again changed to italic also it will still holds bold for already dropped controls.  

if u want reflect all the dropped controls then u need to specify the Default Value designer attribute.  if you specify the default value then it will not generate any code for that property.

for more information check the following links...

http://msdn.microsoft.com/en-us/library/53b8022e.aspx

http://www.codeproject.com/Articles/58659/Control-s-Default-Property-Value

Posted by Phillip Molly Malone on 06-Nov-2013 18:12

This is as expected and designed. The answer is to use ABL User Control. This will also update to look the same but you can lose some flexibility in doing this.

HTH

Posted by Tung on 07-Nov-2013 04:09

Thanks for the links, bab. I'll see if I can adapt the examples to existing properties on the control, not new properties.

Posted by Tung on 07-Nov-2013 04:20

For anyone who's used Infragistics' AppStylist, would that be an alternative solution to this issue? I've only read about it but it sounds like something we'd want to implement later.

This thread is closed