|
|
@@ -0,0 +1,145 @@
|
|
|
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
|
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
+ xmlns:c="clr-namespace:SKMC.UI.CustomControls">
|
|
|
+ <ResourceDictionary.MergedDictionaries>
|
|
|
+ <ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Assets/Brushes.xaml"/>
|
|
|
+ </ResourceDictionary.MergedDictionaries>
|
|
|
+ <!--主要输入文本框-->
|
|
|
+ <Style x:Key="TextBox.Primary" TargetType="{x:Type c:SKTextBox}">
|
|
|
+ <Style.Setters>
|
|
|
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
|
+ <Setter Property="FontSize" Value="12"/>
|
|
|
+ <Setter Property="Template">
|
|
|
+ <Setter.Value>
|
|
|
+ <ControlTemplate TargetType="{x:Type c:SKTextBox}">
|
|
|
+ <Border BorderThickness="1"
|
|
|
+ Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
+ CornerRadius="{Binding CornerRadius, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
+ x:Name="boder">
|
|
|
+ <FrameworkElement.Style>
|
|
|
+ <Style TargetType="{x:Type Border}">
|
|
|
+ <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border}" />
|
|
|
+ <Style.Triggers>
|
|
|
+ <DataTrigger Value="True" Binding="{Binding IsFocused, ElementName=TextBox}">
|
|
|
+ <Setter Property="BorderBrush" Value="{DynamicResource Brush.Signature}" />
|
|
|
+ </DataTrigger>
|
|
|
+ <DataTrigger Value="False" Binding="{Binding IsEnabled, ElementName=TextBox}">
|
|
|
+ <Setter Property="BorderBrush" Value="{DynamicResource Brush.IconInactive}" />
|
|
|
+ </DataTrigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+ </FrameworkElement.Style>
|
|
|
+ <Grid>
|
|
|
+ <Grid.ColumnDefinitions>
|
|
|
+ <ColumnDefinition Width="Auto" />
|
|
|
+ <ColumnDefinition Width="*" />
|
|
|
+ <ColumnDefinition Width="Auto" />
|
|
|
+ </Grid.ColumnDefinitions>
|
|
|
+ <Path Grid.Column="0"
|
|
|
+ Data="{TemplateBinding Icon}"
|
|
|
+ Width="{TemplateBinding IconSize}"
|
|
|
+ Height="{TemplateBinding IconSize}"
|
|
|
+ Stretch="Uniform"
|
|
|
+ Fill="{TemplateBinding Foreground}"
|
|
|
+ VerticalAlignment="Center"
|
|
|
+ HorizontalAlignment="Center"
|
|
|
+ Margin="5">
|
|
|
+ <FrameworkElement.Style>
|
|
|
+ <Style TargetType="{x:Type Path}">
|
|
|
+ <Style.Triggers>
|
|
|
+ <DataTrigger Binding="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
+ Value="{x:Null}">
|
|
|
+ <Setter Property="Visibility" Value="Collapsed" />
|
|
|
+ </DataTrigger>
|
|
|
+ <DataTrigger Value="" Binding="{Binding Icon, RelativeSource={RelativeSource TemplatedParent}}">
|
|
|
+ <Setter Property="Visibility" Value="Collapsed" />
|
|
|
+ </DataTrigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+ </FrameworkElement.Style>
|
|
|
+ </Path>
|
|
|
+ <!--输入框-->
|
|
|
+ <TextBox
|
|
|
+ Name="TextBox"
|
|
|
+ Grid.Column="1"
|
|
|
+ VerticalAlignment="Stretch"
|
|
|
+ HorizontalAlignment="Stretch"
|
|
|
+ Background="Transparent"
|
|
|
+ CaretBrush="{TemplateBinding Foreground}"
|
|
|
+ FontSize="{TemplateBinding FontSize}"
|
|
|
+ SelectionBrush="{DynamicResource Brush.Border}"
|
|
|
+ VerticalContentAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
+ HorizontalContentAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
+ Foreground="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
+ Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
+ TextWrapping="{Binding TextWrapping, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
+ AcceptsReturn="{Binding AcceptsReturn, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
+ ToolTip="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}">
|
|
|
+ <FrameworkElement.Style>
|
|
|
+ <Style TargetType="{x:Type TextBox}">
|
|
|
+ <Setter Property="BorderThickness" Value="0"/>
|
|
|
+ <Setter Property="TextBoxBase.CaretBrush" Value="{DynamicResource Brush.Text}" />
|
|
|
+ <Setter Property="Padding" Value="4,0,0,0"/>
|
|
|
+ <Setter Property="ToolTipService.ShowOnDisabled" Value="True"/>
|
|
|
+ <Setter Property="VerticalAlignment" Value="Center"/>
|
|
|
+ <Style.Triggers>
|
|
|
+ <DataTrigger
|
|
|
+ Value="Wrap"
|
|
|
+ Binding="{Binding TextWrapping, RelativeSource={RelativeSource TemplatedParent}}">
|
|
|
+ <Setter Property="TextBoxBase.AcceptsReturn" Value="True" />
|
|
|
+ </DataTrigger>
|
|
|
+ <DataTrigger
|
|
|
+ Value="WrapWithOverflow"
|
|
|
+ Binding="{Binding TextWrapping, RelativeSource={RelativeSource TemplatedParent}}">
|
|
|
+ <Setter Property="TextBoxBase.AcceptsReturn" Value="True" />
|
|
|
+ </DataTrigger>
|
|
|
+ <DataTrigger Value="NoWrap" Binding="{Binding TextWrapping, RelativeSource={RelativeSource TemplatedParent}}">
|
|
|
+ <Setter Property="TextBoxBase.AcceptsReturn" Value="False" />
|
|
|
+ </DataTrigger>
|
|
|
+ <!--<DataTrigger Binding="{Binding Unit, RelativeSource={RelativeSource TemplatedParent}}" Value="{x:Null}">
|
|
|
+ <Setter Property="Padding" Value="5,0" />
|
|
|
+ </DataTrigger>
|
|
|
+ <DataTrigger Value="" Binding="{Binding Unit, RelativeSource={RelativeSource TemplatedParent}}">
|
|
|
+ <Setter Property="Padding" Value="5,0" />
|
|
|
+ </DataTrigger>-->
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+ </FrameworkElement.Style>
|
|
|
+ </TextBox>
|
|
|
+ <!--单位-->
|
|
|
+ <Label
|
|
|
+ Grid.Column="2"
|
|
|
+ Foreground="{DynamicResource Brush.Label}"
|
|
|
+ Content="{Binding Unit, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
+ FontSize="{TemplateBinding UnitSize}">
|
|
|
+ <FrameworkElement.Style>
|
|
|
+ <Style TargetType="{x:Type Label}">
|
|
|
+ <Setter Property="VerticalAlignment" Value="Bottom"/>
|
|
|
+ <Setter Property="HorizontalAlignment" Value="Right"/>
|
|
|
+ <Setter Property="Background" Value="Transparent"/>
|
|
|
+ <Setter Property="BorderThickness" Value="0"/>
|
|
|
+ <Style.Triggers>
|
|
|
+ <DataTrigger Binding="{Binding Unit, RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
+ Value="{x:Null}">
|
|
|
+ <Setter Property="Visibility" Value="Collapsed" />
|
|
|
+ </DataTrigger>
|
|
|
+ <DataTrigger Value="" Binding="{Binding Unit, RelativeSource={RelativeSource TemplatedParent}}">
|
|
|
+ <Setter Property="Visibility" Value="Collapsed" />
|
|
|
+ </DataTrigger>
|
|
|
+ </Style.Triggers>
|
|
|
+ </Style>
|
|
|
+ </FrameworkElement.Style>
|
|
|
+ </Label>
|
|
|
+ </Grid>
|
|
|
+ </Border>
|
|
|
+ <ControlTemplate.Triggers>
|
|
|
+ <Trigger Property="Validation.HasError" Value="True">
|
|
|
+ <Setter TargetName="boder" Property="BorderBrush" Value="{StaticResource Brush.Error}"/>
|
|
|
+ </Trigger>
|
|
|
+ </ControlTemplate.Triggers>
|
|
|
+ </ControlTemplate>
|
|
|
+ </Setter.Value>
|
|
|
+ </Setter>
|
|
|
+ </Style.Setters>
|
|
|
+ </Style>
|
|
|
+</ResourceDictionary>
|