【发布时间】:2016-08-19 03:56:27
【问题描述】:
我有一个 TextBox 控件。当我将 IsReadOnly 属性设置为 True 时,我为 Background 属性指定的值将被忽略。当 IsReadOnly 设置为 False 时,使用我为 Background 属性指定的值。
有谁知道为什么当 IsReadOnly 属性设置为 True 时会忽略 Background 属性?
<TextBox x:Name="txt"
Grid.Row="0"
Grid.Column="1"
Margin="10 2"
IsReadOnly="True"
Background="#538DD5"
FontWeight="Bold"
Text="0"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center" />
【问题讨论】:
-
您是否有任何样式可以应用于所有
TextBox控件? -
不,我没有将样式应用于 TextBox,只有另一个 Grid 中的 DataGrid