1

TextBoxコントロールのカスタム スタイルを作成しましたが、それを使用しているときにTextBox、実行中にテキストを入力できません。これが私のスタイルです:

<Style x:Key="TextBoxStyle"
       TargetType="TextBox" >
        <Setter Property="Height" Value="41"></Setter>
        <Setter Property="Width" Value="114"></Setter>
        <Setter Property="Foreground" Value="#FFDDDDDD"></Setter>
        <Setter Property="Focusable" Value="False"></Setter>
        <Setter Property="FontFamily" Value="Verdana"></Setter>
        <Setter Property="FontSize" Value="18"></Setter>
        <Setter Property="FontWeight" Value="Regular"></Setter>
        <Setter Property="TextAlignment" Value="Center"></Setter>
        <Setter Property="IsReadOnly" Value="False"></Setter>
        <Setter Property="BorderBrush" Value="{x:Null}"></Setter>
        <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
        <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
        <Setter Property="Background">
            <Setter.Value>
                <ImageBrush ImageSource="/App;component/Images/BarsForms/precent_bg.png" Stretch="UniformToFill" TileMode="None" />    
            </Setter.Value>
        </Setter>
    </Style>
4

1 に答える 1

1
<Setter Property="Focusable" Value="False"></Setter>

Focusableスタイルで false に設定すると、カーソルが を選択できなくなりTextBox、カーソルを入力用に設定できなくなります。

于 2013-01-29T11:48:50.153 に答える