Page 1 of 1
Background color on textfield, color defined in datasource.
Posted: Thu Mar 31, 2011 9:04 am
by malbrigt
I need to set the background-color of a textfield with a color given from my datasource. The textfield (datasource value) is on a databand.
I'm using the latest prerelease, designing with WebDesigner.Silverlight.
Any ideas?
Background color on textfield, color defined in datasource.
Posted: Fri Apr 01, 2011 5:16 am
by Jan
Hello,
Can you provide any sample in which format colors stored in your database? For example: Blacm, Red or 0xffffff or somethin also?
Thank you.
Background color on textfield, color defined in datasource.
Posted: Mon Apr 04, 2011 1:01 am
by malbrigt
Thanks for replying.
I'm using rgb hex values for colors (0xRRGGBB), if there's a more convenient format I can change the data source XML.
Background color on textfield, color defined in datasource.
Posted: Mon Apr 04, 2011 3:40 am
by Ivan
Hello,
You can use the following code in the BeforePrint event of databand, for example:
Code: Select all
Text1.Brush = new StiSolidBrush(Color.FromArgb((int)(0xFF000000 | DataSource.ColorField)));
Please check the report sample in the attachment.
Thank you.
Background color on textfield, color defined in datasource.
Posted: Mon Apr 04, 2011 4:15 am
by malbrigt
Thanks alot Ivan, that worked! :biggrin:
Background color on textfield, color defined in datasource.
Posted: Mon Apr 04, 2011 5:32 am
by Andrew
Great!
Have a nice day!