3

読み取り専用テキストボックスの色を変更したい

デフォルトの色を白色に変更することが可能

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

およびテキストボックスとして

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

前もって感謝します

4

1 に答える 1

6

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.
于 2013-02-05T06:44:59.533 に答える