您好,这个也是我在网上的看的,您可以参照,因为textbox不是我们控件我也说不准,希望能帮到您
- 1、XAML
- <TextBox HorizontalAlignment="Left" Height="30" FontSize="15" TextWrapping="NoWrap" Text="TextBox" VerticalAlignment="Top" Width="150" Style="{DynamicResource TextBoxStyle1}" VerticalContentAlignment="Center" BorderBrush="#E3E3E3" BorderThickness="1"/>
- 2、Style
- <SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/>
- <SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA"/>
- <SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5"/>
- <Style x:Key="TextBoxStyle1" TargetType="{x:Type TextBox}">
- <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
- <Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}"/>
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
- <Setter Property="BorderThickness" Value="1"/>
- <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
- <Setter Property="HorizontalContentAlignment" Value="Left"/>
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="AllowDrop" Value="true"/>
- <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
- <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type TextBox}">
复制代码 |