How to change background colors in ReadOnly textbox in silverlight 5?

╄→尐↘猪︶ㄣ 提交于 2019-12-10 09:51:48

问题


I Want To Change Color of ReadOnly Textbox

It is Possible To Change Default Color to white Color

<Style TargetType="TextBox">
            <Setter Property="Background"
                Value="White"/>
            <Setter Property="Foreground"
                Value="Black"/>
        </Style>

and textbox as

<TextBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch" Height="18" Padding="0" IsReadOnly="True" Margin="3,0,3,0"/>

Thanks In Advance


回答1:


The problem is not that the Background Setter doesn't work, it is that the ReadOnly state for the TextBox has a gray overlay.

There are two options here:

  1. Edit the control template for the TextBox in Expression Blend, and get rid of the overlay.
  2. Set IsReadOnly to false and set IsHitTestVisible to false, this will prevent editting of the TextBox without changing its Visual State.


来源:https://stackoverflow.com/questions/14700272/how-to-change-background-colors-in-readonly-textbox-in-silverlight-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!