Files
ShrlAlgoToolkit/AntDesignWPF/Controls/Input.xaml
2025-07-31 20:12:24 +08:00

77 lines
4.2 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:AntDesignWPF.Controls"
xmlns:helpers="clr-namespace:AntDesignWPF.Helpers"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- TextBox/PasswordBox/ComboBox -->
<Style TargetType="{x:Type Control}" x:Key="Ant.Input">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />
<Setter Property="FontSize" Value="{DynamicResource FontSizeBase}" />
<Setter Property="Height" Value="{DynamicResource InputHeightBase}" />
<Setter Property="Padding" Value="{DynamicResource InputPaddingBase}" />
<Setter Property="Foreground" Value="{DynamicResource AntDesign.Brush.TextPrimary}" />
<Setter Property="Background" Value="{DynamicResource AntDesign.Brush.BackgroundContainer}" />
<Setter Property="BorderBrush" Value="{DynamicResource AntDesign.Brush.BorderPrimary}" />
<Setter Property="BorderThickness" Value="{DynamicResource BorderThicknessBase}" />
<Setter Property="helpers:AntControl.BorderStyle" Value="{DynamicResource BorderStyleBase}" />
<Setter Property="helpers:AntControl.CornerRadius" Value="{DynamicResource BorderRadiusBase}" />
<Setter Property="helpers:Input.PlaceholderBrush" Value="{DynamicResource AntDesign.Brush.TextQuaternary}" />
<Style.Triggers>
<!-- Sizes -->
<Trigger Property="helpers:AntControl.Size" Value="Large">
<Setter Property="FontSize" Value="{DynamicResource FontSizeLarge}" />
<Setter Property="Height" Value="{DynamicResource InputHeightLarge}" />
<Setter Property="Padding" Value="{DynamicResource InputPaddingLarge}" />
</Trigger>
<Trigger Property="helpers:AntControl.Size" Value="Small">
<Setter Property="Height" Value="{DynamicResource InputHeightSmall}" />
<Setter Property="Padding" Value="{DynamicResource InputPaddingSmall}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource AntDesign.Brush.Primary}" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource AntDesign.Brush.Primary}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource AntDesign.Brush.TextQuaternary}" />
<Setter Property="Background" Value="{DynamicResource InputDisabledBackground}" />
</Trigger>
</Style.Triggers>
</Style>
<!-- PasswordBox/ComboBox -->
<Style TargetType="{x:Type TextBox}" x:Key="Ant.EditableTextBox">
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<!-- TextBox 将自动处理填充,因此您需要将边距更改为负值。 -->
<ScrollViewer
Background="{x:Null}"
BorderThickness="0"
IsTabStop="False"
x:Name="PART_ContentHost" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- TextBox/PasswordBox/ComboBox -->
<Style TargetType="{x:Type FrameworkElement}" x:Key="Ant.Clearable">
<Setter Property="Opacity" Value="0.65" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="1" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>