tags:

views:

315

answers:

2

I am using themes from the Silverlight toolkit, however several of them have poor readonly textbox styles (i.e. there is no visual representation when the textbox's are readonly.

How can I use the themes, but tweak a textbox readonly style? (Because I am extensivly using the dataform this can only apply when the textbox is readony)

+1  A: 

You'd need to start with the XAML and use it (implicit style support is built into Silverlight 4 now), or otherwise rebuild starting with the Toolkit theme you like.

Jeff Wilcox
Right, sounds good, but how do I apply an implicit style to a TextBox when it is readonly? I guess I could just make my own textbox, but there must be a way to apply a style depending on the IsReadOnly Property (the themes do this somehow)
Grayson Mitchell
A: 

Easy enough in Silverlight 4 (once I got a little more familer with styling.

 <df:DataForm.ReadOnlyTemplate>
        <DataTemplate>
            <StackPanel Name="rootPanel" 
                        Orientation="Vertical">
                <StackPanel.Resources>
                    <Style TargetType="TextBox">
                        <Setter Property="Foreground" Value="LightGray" ></Setter>
                        <Setter Property="Background" Value="Red" ></Setter>
                    </Style>
Grayson Mitchell