Question

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?

Was it helpful?

Solution

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. :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top