74 lines
4.3 KiB
Plaintext
74 lines
4.3 KiB
Plaintext
|
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
|
|
xmlns:models="clr-namespace:UIStandard.Assets.Styles.Models">
|
||
|
|
|
||
|
|
<SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFCED5E1"/>
|
||
|
|
<SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA"/>
|
||
|
|
<SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF2563EB"/>
|
||
|
|
|
||
|
|
<FontFamily x:Key="SourceHanSansCNRegular">
|
||
|
|
/UIStandard.Assets;component/Fonts/SourceHanSansCN-Regular.ttf#思源黑体 CN</FontFamily>
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type models:IconTextBox}">
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type models:IconTextBox}">
|
||
|
|
<!-- 外层边框(用于悬停和焦点效果) -->
|
||
|
|
<Border x:Name="Border"
|
||
|
|
Background="{TemplateBinding Background}" BorderBrush="#FFCED5E1"
|
||
|
|
BorderThickness="1" Padding="5">
|
||
|
|
<Grid>
|
||
|
|
<Grid.ColumnDefinitions>
|
||
|
|
<ColumnDefinition Width="Auto"/>
|
||
|
|
<ColumnDefinition Width="Auto"/>
|
||
|
|
<ColumnDefinition Width="*"/>
|
||
|
|
</Grid.ColumnDefinitions>
|
||
|
|
|
||
|
|
<!-- 图标 -->
|
||
|
|
<Image x:Name="Icon" Grid.Column="0" Source="{TemplateBinding IconSource}"
|
||
|
|
Width="20" Height="20" Margin="2,0,5,0" Stretch="Fill"/>
|
||
|
|
<!-- 竖线 -->
|
||
|
|
<Rectangle x:Name="VerticalLine" Grid.Column="1" Width="1"
|
||
|
|
Height="12" Fill="#FFCED5E1" Margin="7,0,5,0"/>
|
||
|
|
<!-- 提示文字 -->
|
||
|
|
<TextBlock x:Name="HintTextBlock" Grid.Column="2" FontSize="13"
|
||
|
|
Text="{TemplateBinding HintText}" Foreground="#FFDADDE2"
|
||
|
|
VerticalAlignment="Center" Margin="7,0,0,0"
|
||
|
|
Visibility="Collapsed" FontWeight="Regular"
|
||
|
|
FontFamily="{StaticResource SourceHanSansCNRegular}"/>
|
||
|
|
<!-- 输入区域 -->
|
||
|
|
<TextBox x:Name="PART_TextBox" Grid.Column="2"
|
||
|
|
Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||
|
|
BorderThickness="0" Background="Transparent"
|
||
|
|
Foreground="#FF333333" FontSize="13" FontWeight="Regular"
|
||
|
|
VerticalAlignment="Center" Margin="7,0,0,0"
|
||
|
|
IsHitTestVisible="True" Focusable="True"
|
||
|
|
FontFamily="{StaticResource SourceHanSansCNRegular}"/>
|
||
|
|
</Grid>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<!-- 触发器 -->
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<!-- 显示提示文字 -->
|
||
|
|
<Trigger SourceName="PART_TextBox" Property="Text" Value="">
|
||
|
|
<Setter TargetName="HintTextBlock" Property="Visibility" Value="Visible"/>
|
||
|
|
</Trigger>
|
||
|
|
|
||
|
|
<!-- 鼠标悬停边框颜色 --><!--
|
||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
|
<Setter TargetName="Border" Property="BorderBrush" Value="#0078D4"/>
|
||
|
|
<Setter TargetName="VerticalLine" Property="Fill" Value="#0078D4"/>
|
||
|
|
</Trigger>-->
|
||
|
|
|
||
|
|
<!-- 焦点时边框颜色 -->
|
||
|
|
<Trigger Property="IsKeyboardFocusWithin" Value="True">
|
||
|
|
<Setter TargetName="Border" Property="BorderBrush" Value="#FF2563EB"/>
|
||
|
|
<!--<Setter TargetName="VerticalLine" Property="Fill" Value="#0078D4"/>-->
|
||
|
|
</Trigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
</ResourceDictionary>
|