Hi
We are using StyleManager to 'style' our controls on a winform, this is great and makes it much easier for new forms, however we have 100's of existing forms I'm currently editing as they have been coded to use the style set in the winform properties of the control. (the setting "ControlThenApplication" is set in the style sheet as we wan't to have the ability to "override" the style set in the ISL file.
On loads of our forms where we display the data from the DB to the user we generally use labels - we have two labels, one for the title/caption and one for the data.
E.G
Forename: NameHere
Surname: NameHere
the Caption Labels take the style from the style sheet, however we have to hardcode that the value labels are "Green". Which means if we use a different style sheet, they will still be green.
Is there a better way to set all these value labels to a different forecolor from the caption label within the style file???
Thanks
Hello Harag,
In order to set the text color of certain labels in your .isl file and have it be picked up from there rather than having to hard code it, I would recommend creating a Resource in AppStylist that has the styling that you are looking to apply to these particular labels and give it a unique name that you can use to identify that resource.
In your application, the labels that you are using will have an Appearance.StyleResourceName property. If you set this property on your element to the name of your Resource in the .isl file, it will override the default styling that you have provided for those particular label elements.
I have attached a sample project and sample .isl file to demonstrate. I hope this helps.
Please let me know if you have any other questions or concerns on this matter.
WinFormsLabelStylingDemo.zip
Sincerely,AndrewSoftware Developer
Hi Andrew,
Many thanks for demo, I wasn't aware of the StyleResourceName, they are so many properties to the controls. I did have a play around with the app style application and found a property on the controls called "StyleSetName" which seems very useful as it looks like I can "cascade" the appearance down from the "default" style, so I can keep the same background / borders from the default style and then add on the coloured text using the StyleSetName property.