我正在使用以下 TextBox 样式。如果我继续在文本框中输入,如果文本变得太长,它将不会滚动到插入符号。而且我不能拖动来滚动文本。我错过了什么吗?
<Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="{StaticResource TextBoxBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{StaticResource TextBoxBorderBrush}"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="FontSize" Value="26"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="MaxLines" Value="1"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Height" Value="50"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Grid>
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}" CornerRadius="2" SnapsToDevicePixels="true">
<Border.Effect>
<DropShadowEffect Direction="-90" ShadowDepth="2"/>
</Border.Effect>
</Border>
<Border BorderBrush="{TemplateBinding BorderBrush}" x:Name="GlowBd" BorderThickness="2" CornerRadius="2" SnapsToDevicePixels="true">
<Border.Effect>
<DropShadowEffect Direction="360" BlurRadius="6" ShadowDepth="0"/>
</Border.Effect>
</Border>
<Grid Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ContentControl Content="{TemplateBinding Tag}"/>
<ScrollViewer Grid.Column="1" Margin="{TemplateBinding Padding}" x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Grid>
</Grid>
<!-- Some triggers -->
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>