Styling the Silverlight 4 Business Application Login Form
When creating an app based on the Silverlight Business Application template, a number of styles are generated in Styles.xaml. These, for the most part, are self-explanatory.
I am interested in giving the Login form a dark background, which I can accomplish by manipulating the LogRegWindowStyle style. Now, I want to change the default black text of the User name and Password labels to something lighter, but what do I do?
The LoginTextStyle style seems to be the most likely candidate but it is not referenced anywhere and setting a Foreground value does not seem to have an effect. So why is it there?
Finally, the labels turn red when an error occurs so is this achieved by a style or is it hard-coded somewhere? How would I change it if there wasn't enough contrast with开发者_运维知识库 the background?
the login text style is inherited from the loginFrom style LoginDataFormStyle. If you set a Foreground color in the LoginDataFormStyle, the foreground of the text will also be changed.
<!-- LoginDataForm Style -->
<Style x:Key="LoginDataFormStyle" TargetType="dataControls:DataForm">
<Setter Property="Foreground" Value="Gray"/>
To change the color of the Labels, you can create your own DataTemplate of your loginFrom and put in whatever Labels you need. Then you can create a style for your Label and change the Color from 'Red'(default color) to something you like in the Label's Invalid visual state.
Hope this helps. :)
精彩评论