Hello guys,
I want apply different styles to an UltraTextEditor field at runtime, depending of the state; Read-Only, Required or Optional, as shown. is this possible with AppStylist?
Yes, it is possible.
The most simple solution is to define 3 different styles for UltraTextEditor, naming them "TextEditorLocked", "TextEditorRequired" and "TextEditorOptional". And then, in code, then the contol state changes you will have to set the StyleSetName to one of the names mentioned above.
Another solution may be to define the style for the read-only control and for a normal one (it might be for the required or optional). After that you will have to define only one extra style, "TextEditorRequired" or "TextEditorOptional", and apply it by code when the state of the control changes: if the control is in a standard style (not defined by name) the StyleSetName has to be set to the empty string, otherwise to the named style.
HTH,
Emanuel
Sorry, but I have tried to define additional style sets for the UltraTextEditor control, changing only the back color and allways get this as the resultant color, at least at the Editors tab of the appStylist program. I don't have tried this on code yet.
I enclose my isl file. Can you make a sample? thanks
Alfonso
The previous isl file is the original (default).
Attached to this post is the modified with the added styleset.
Thanks
Hello,
I've attached a simple project which I hope will not only solve your problem, but will also help you understand how style sets work.
In the isl (style library), I have defined 3 additional style sets which only modify the background colour of the text editor. Everything else is inherited from the default style set, and is unmodified.
I've added 3 text editors on the form, and in code you can easily set the corresponding style set for each one of them:
txtReadOnly.StyleSetName = "TextEditorReadOnly"; txtRequired.StyleSetName = "TextEditorRequired"; txtOptional.StyleSetName = "TextEditorOptional";
There are more controls on the form which are styled by the default set and are unaffected by our additional styles.
Hope this helps,
Cosmin
Thank you very much. It works OK and is just as intended. And YES, this has allowed me to understand the inheritance and how style sets works.
To learn more about the Infragistics Application Styling Framework (ASF), please visit our online help documentation found by clicking here. Please let me know if you have additional questions about using styleSets.