Prechádzať zdrojové kódy

增加常用控件样式

Jiangsheng 1 mesiac pred
rodič
commit
f059d8bdb9

+ 1 - 1
SKMC.UI/Assets/Brushes.xaml

@@ -28,7 +28,7 @@
     <SolidColorBrush x:Key="Brush.PrimaryButton" Color="{DynamicResource Color.Signature}" />
     <SolidColorBrush x:Key="Brush.PrimaryButtonMouseOver" Opacity="0.24" Color="{DynamicResource Color.Signature}" />
     <SolidColorBrush x:Key="Brush.PrimaryButtonPressed" Color="{DynamicResource Color.SignatureDark}" />
-    <SolidColorBrush x:Key="Brush.PrimaryButtonDisabled" Opacity="0.03" Color="{StaticResource Color.Overlay}" />
+    <SolidColorBrush x:Key="Brush.PrimaryButtonDisabled" Opacity="0.5" Color="{StaticResource Color.SignatureDark}" />
     <SolidColorBrush x:Key="Brush.SecondaryButton" Opacity="0.12" Color="{StaticResource Color.Overlay}" />
     <SolidColorBrush x:Key="Brush.SecondaryButtonMouseOver" Opacity="0.24" Color="{StaticResource Color.Overlay}" />
     <SolidColorBrush x:Key="Brush.SecondaryButtonPressed" Opacity="0.08" Color="{StaticResource Color.Overlay}" />

+ 9 - 0
SKMC.UI/Assets/Icons.xaml

@@ -1139,4 +1139,13 @@
     <GeometryGroup x:Key="Icon.Filtered" FillRule="EvenOdd">
         <PathGeometry Figures="M 7 20 V 13.5612 C 7 13.3532 7 13.2492 6.9796 13.1497 C 6.9615 13.0615 6.9315 12.9761 6.8905 12.8958 C 6.8443 12.8054 6.7793 12.7242 6.6494 12.5617 L 3.3506 8.4383 C 3.2207 8.2758 3.1557 8.1946 3.1095 8.1042 C 3.0685 8.0239 3.0385 7.9385 3.0204 7.8503 C 3 7.7508 3 7.6468 3 7.4387 V 5.6 C 3 5.04 3 4.7599 3.109 4.546 C 3.2049 4.3579 3.3579 4.2049 3.546 4.109 C 3.7599 4 4.04 4 4.6 4 H 13.4 C 13.9601 4 14.2401 4 14.454 4.109 C 14.6422 4.2049 14.7951 4.3579 14.891 4.546 C 15 4.7599 15 5.04 15 5.6 V 7.4387 C 15 7.6468 15 7.7508 14.9796 7.8503 C 14.9615 7.9385 14.9315 8.0239 14.8905 8.1042 C 14.8443 8.1946 14.7793 8.2758 14.6494 8.4383 L 11.3506 12.5617 C 11.2207 12.7242 11.1557 12.8054 11.1095 12.8958 C 11.0685 12.9761 11.0385 13.0615 11.0204 13.1497 C 11 13.2492 11 13.3532 11 13.5612 V 17 L 7 20" />
     </GeometryGroup>
+    <!--扩展-->
+    <GeometryGroup x:Key="Icon.Electricity">
+        <PathGeometry Figures="M790.74 233.26C719.4 161.92 620.85 117.8 512 117.8s-207.4 44.12-278.74 115.46S117.8 403.15 117.8 512s44.12 207.4 115.46 278.74S403.15 906.2 512 906.2s207.4-44.12 278.74-115.46S906.2 620.85 906.2 512s-44.12-207.4-115.46-278.74z m-21.21 536.27C703.62 835.44 612.57 876.2 512 876.2s-191.62-40.76-257.53-106.67S147.8 612.57 147.8 512c0-100.57 40.76-191.62 106.67-257.53S411.43 147.8 512 147.8s191.62 40.76 257.53 106.67S876.2 411.43 876.2 512c0 100.57-40.76 191.62-106.67 257.53z" />
+        <PathGeometry Figures="M512 488.54L356.47 336.36H325.4v357.6h30V377.17L512 530.39l156.6-153.22v316.79h30v-357.6h-31.07L512 488.54z"/>
+    </GeometryGroup>
+    <GeometryGroup x:Key="Icon.Flow">
+        <PathGeometry Figures="M544 704h-192a32 32 0 0 1-32-32v-96a32 32 0 0 1 64 0v64h160v-64a32 32 0 0 1 32-32h192a32 32 0 0 1 32 32v192a32 32 0 0 1-32 32h-192a32 32 0 0 1-32-32v-64z m-64-320v64a32 32 0 0 1-32 32H256a32 32 0 0 1-32-32V256a32 32 0 0 1 32-32h192a32 32 0 0 1 32 32v64h192a32 32 0 0 1 32 32v96a32 32 0 0 1-64 0v-64h-160z m-192 32h128V288H288v128z m320 320h128v-128h-128v128z"/>
+    </GeometryGroup>
+    <PathGeometry x:Key="Icon.Debug" Figures="M547.707 374.32V48.181c0-19.707-16-35.682-35.707-35.682s-35.707 15.975-35.707 35.682V374.32c-61.412 15.926-107.021 71.241-107.021 137.679 0 66.439 45.61 121.778 107.021 137.706v325.114c0 20.268 16 36.683 35.707 36.683s35.707-16.415 35.707-36.707v-325.14c61.413-15.902 107.021-71.267 107.021-137.681 0.001-66.436-45.608-121.728-107.021-137.654zM189.91 730.824c0.244-1.61 0.976-3.073 0.976-4.757V48.181c0-19.707-15.951-35.682-35.707-35.682-19.658 0-35.609 15.975-35.609 35.682v677.886c0 1.684 0.683 3.146 0.927 4.757-63.413 15.779-107.9 72.656-107.998 137.972 0 78.804 63.901 142.705 142.68 142.705 78.828 0 142.729-63.901 142.729-142.705-0.098-65.316-44.585-122.192-107.998-137.972z m-34.731 209.313c-39.365 0-71.315-31.976-71.315-71.39s31.951-71.339 71.364-71.339c39.414 0 71.364 31.95 71.364 71.388 0 39.414-31.95 71.364-71.413 71.341z m856.322-784.934c0-78.803-63.901-142.704-142.729-142.704-78.778 0-142.729 63.901-142.729 142.704 0.146 65.315 44.633 122.191 107.997 137.997-0.194 1.585-0.927 3.073-0.927 4.731v677.912c0 19.682 15.951 35.658 35.658 35.658s35.657-15.977 35.657-35.658V297.931c0-1.658-0.731-3.146-0.927-4.731 63.415-15.805 107.902-72.681 108-137.997z m-142.729 71.363c-39.414 0-71.364-31.974-71.364-71.388s31.999-71.364 71.413-71.34c39.414 0 71.364 31.95 71.364 71.364 0.001 39.439-31.998 71.39-71.413 71.364z"/>
 </ResourceDictionary>

+ 125 - 0
SKMC.UI/CustomControls/SKTextBox.cs

@@ -0,0 +1,125 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace SKMC.UI.CustomControls
+{
+    public class SKTextBox : TextBox
+    {
+        static SKTextBox()
+        {
+            DefaultStyleKeyProperty.OverrideMetadata(typeof(SKTextBox), new FrameworkPropertyMetadata(typeof(SKTextBox)));
+        }
+        public string Label
+        {
+            get { return (string)GetValue(LabelProperty); }
+            set { SetValue(LabelProperty, value); }
+        }
+        /// <summary>
+        /// 单位
+        /// </summary>
+        public string Unit
+        {
+            get { return (string)GetValue(UnitProperty); }
+            set { SetValue(UnitProperty, value); }
+        }
+
+        /// <summary>
+        /// 单位字体大小
+        /// </summary>
+        public double UnitSize
+        {
+            get { return (double)GetValue(UnitSizeProperty); }
+            set { SetValue(UnitSizeProperty, value); }
+        }
+
+        /// <summary>
+        /// 值是否有效
+        /// </summary>
+        public bool IsValueValid
+        {
+            get { return (bool)GetValue(IsValueValidProperty); }
+            set { SetValue(IsValueValidProperty, value); }
+        }
+        /// <summary>
+        /// 最大值
+        /// </summary>
+        public object MaxValue
+        {
+            get { return (object)GetValue(MaxValueProperty); }
+            set { SetValue(MaxValueProperty, value); }
+        }
+        /// <summary>
+        /// 最小值
+        /// </summary>
+        public object MinValue
+        {
+            get { return (object)GetValue(MinValueProperty); }
+            set { SetValue(MinValueProperty, value); }
+        }
+        /// <summary>
+        /// 圆角
+        /// </summary>
+        public CornerRadius CornerRadius
+        {
+            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
+            set { SetValue(CornerRadiusProperty, value); }
+        }
+
+        public string ToolTipComment
+        {
+            get { return (string)GetValue(ToolTipCommentProperty); }
+            set { SetValue(ToolTipCommentProperty, value); }
+        }
+        /// <summary>
+        /// 图标
+        /// </summary>
+        public Geometry Icon
+        {
+            get { return (Geometry)GetValue(IconProperty); }
+            set { SetValue(IconProperty, value); }
+        }
+
+        public double IconSize
+        {
+            get { return (double)GetValue(IconSizeProperty); }
+            set { SetValue(IconSizeProperty, value); }
+        }
+
+        public static readonly DependencyProperty IconProperty =
+            DependencyProperty.Register("Icon", typeof(Geometry), typeof(SKTextBox), new PropertyMetadata(null));
+
+
+        public static readonly DependencyProperty ToolTipCommentProperty =
+            DependencyProperty.Register("ToolTipComment", typeof(string), typeof(SKTextBox), new PropertyMetadata(null));
+
+        public static readonly DependencyProperty CornerRadiusProperty =
+            DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(SKTextBox), new PropertyMetadata(new CornerRadius(0)));
+
+        public static readonly DependencyProperty MinValueProperty =
+            DependencyProperty.Register("MinValue", typeof(object), typeof(SKTextBox), new PropertyMetadata(null));
+
+        public static readonly DependencyProperty MaxValueProperty =
+            DependencyProperty.Register("MaxValue", typeof(object), typeof(SKTextBox), new PropertyMetadata(null));
+
+        public static readonly DependencyProperty IsValueValidProperty =
+            DependencyProperty.Register("IsValueValid", typeof(bool), typeof(SKTextBox), new PropertyMetadata(true));
+
+        public static readonly DependencyProperty UnitProperty =
+            DependencyProperty.Register("Unit", typeof(string), typeof(SKTextBox), new PropertyMetadata(""));
+
+        public static readonly DependencyProperty LabelProperty =
+            DependencyProperty.Register("Label", typeof(string), typeof(SKTextBox), new PropertyMetadata(""));
+
+        public static readonly DependencyProperty UnitSizeProperty =
+            DependencyProperty.Register("UnitSize", typeof(double), typeof(SKTextBox), new PropertyMetadata(10.0));
+
+        public static readonly DependencyProperty IconSizeProperty =
+            DependencyProperty.Register(nameof(IconSize), typeof(double), typeof(SKTextBox), new PropertyMetadata(10.0));
+    }
+}

+ 3 - 0
SKMC.UI/FrameWork.xaml

@@ -11,6 +11,9 @@
         <ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Styles/Button.xaml"/>
         <ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Styles/RadioButton.xaml"/>
         <ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Styles/ScrollViewer.xaml"/>
+        <ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Styles/TextBox.xaml"/>
+        <ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Styles/ToggleButton.xaml"/>
+        <ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Styles/TextBlock.xaml"/>
         <!--Styles-->
     </ResourceDictionary.MergedDictionaries>
 </ResourceDictionary>

+ 13 - 0
SKMC.UI/SKMC.UI.csproj

@@ -51,6 +51,7 @@
     <Compile Include="CustomControls\SKButton.cs" />
     <Compile Include="CustomControls\SKCheckBox.cs" />
     <Compile Include="CustomControls\SKRadioButton.cs" />
+    <Compile Include="CustomControls\SKTextBox.cs" />
     <Compile Include="Properties\AssemblyInfo.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -110,6 +111,14 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Styles\TextBlock.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Styles\TextBox.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Styles\Button.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -122,6 +131,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Styles\ToggleButton.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 3 - 1
SKMC.UI/Styles/Button.xaml

@@ -8,6 +8,7 @@
         <Setter Property="Height" Value="40"/>
         <Setter Property="BorderThickness" Value="0"/>
         <Setter Property="Foreground" Value="{DynamicResource Brush.Text}"/>
+        <Setter Property="Background" Value="{DynamicResource Brush.Neutral}"/>
         <Setter Property="FontSize" Value="{DynamicResource FontSize.Body}"/>
         <Setter Property="Cursor" Value="Hand"/>
     </Style>
@@ -33,13 +34,14 @@
                         </Trigger>
                         <Trigger Property="IsEnabled" Value="False">
                             <Setter Property="Background" Value="{DynamicResource Brush.PrimaryButtonDisabled}"/>
-                            <Setter Property="Foreground" Value="{DynamicResource Brush.TextInactive}"/>
+                            <!--<Setter Property="Foreground" Value="{DynamicResource Brush.TextInactive}"/>-->
                         </Trigger>
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
             </Setter.Value>
         </Setter>
     </Style>
+    <!--次要按钮-->
     <Style x:Key="Button.Secondary" TargetType="{x:Type Button}" BasedOn="{StaticResource Button.Base}">
         <Setter Property="Background" Value="{DynamicResource Brush.Neutral}"/>
         <Setter Property="Template">

+ 54 - 12
SKMC.UI/Styles/RadioButton.xaml

@@ -1,9 +1,9 @@
 <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">
-
+    <!--系统菜单按钮-->
     <Style x:Key="RadioButton.SystemMenu" TargetType="{x:Type c:SKRadioButton}">
-        <Setter Property="Background" Value="{DynamicResource Brush.Background}"/>
+        <Setter Property="Background" Value="Transparent"/>
         <Setter Property="Foreground" Value="{DynamicResource Brush.Text}"/>
         <Setter Property="Cursor" Value="Hand"/>
         <Setter Property="FontWeight" Value="Normal"/>
@@ -29,10 +29,10 @@
                             <!-- Selected  -->
                             <Border x:Name="btnSelected" Grid.ColumnSpan="2"  CornerRadius="4" Width="210" HorizontalAlignment="Right"/>
                             <!-- Indicator -->
-                            <Rectangle Name="Indicator" HorizontalAlignment="Left" 
+                            <!--<Rectangle Name="Indicator" HorizontalAlignment="Left" 
                                    Width="5" Height="50" VerticalAlignment="Stretch" 
                                    RadiusX="2" RadiusY="2"
-                                   Margin="5 0 0 0"/>
+                                   Margin="5 0 0 0"/>-->
                             <!-- Icon -->
                             <Path x:Name="Icon" Data="{Binding Icon, RelativeSource={RelativeSource AncestorType={x:Type c:SKRadioButton}}}" 
                                   Height="{TemplateBinding IconHeight}" 
@@ -46,14 +46,15 @@
                                   Margin="0 0 3 0"/>
                             <!-- Text -->
                             <TextBlock x:Name="txtName" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5 0 0 0"
-                                        Grid.Column="1" Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}"
-                                        FontWeight="{TemplateBinding FontWeight}"
-                                        FontSize="{TemplateBinding FontSize}"/>
+                                       Grid.Column="1" Text="{TemplateBinding Content}" 
+                                       Foreground="{TemplateBinding Foreground}"
+                                       FontWeight="{TemplateBinding FontWeight}"
+                                       FontSize="{TemplateBinding FontSize}"/>
                         </Grid>
                     </Border>
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="True">
-                            <Setter TargetName="txtName" Property="Foreground" Value="{DynamicResource Brush.TextSecondColor}"/>
+                            <Setter TargetName="txtName" Property="Foreground" Value="{DynamicResource Brush.ChartLine.5}"/>
                             <Setter TargetName="Icon" Property="Fill" Value="{DynamicResource Brush.ButtonHover}"/>
                             <Setter TargetName="Icon" Property="Stroke" Value="{DynamicResource Brush.ButtonHover}"/>
                             <!-- Optional 
@@ -63,9 +64,9 @@
                         <Trigger Property="IsChecked" Value="True">
                             <Setter TargetName="Icon" Property="Fill" Value="{DynamicResource Brush.SelectionSelected}"/>
                             <Setter TargetName="Icon" Property="Stroke" Value="{DynamicResource Brush.SelectionSelected}"/>
-                            <Setter TargetName="Indicator" Property="Fill" Value="{DynamicResource Brush.Overlay3Percent}"/>
-                            <Setter TargetName="Indicator" Property="Height" Value="20"/>
-                            <Setter TargetName="btnSelected" Property="Background" Value="{DynamicResource Brush.SelectionSelected}"/>
+                            <!--<Setter TargetName="Indicator" Property="Fill" Value="{DynamicResource Brush.Overlay3Percent}"/>
+                            <Setter TargetName="Indicator" Property="Height" Value="20"/>-->
+                            <Setter TargetName="btnSelected" Property="Background" Value="#3A3A3A"/>
                             <Setter TargetName="txtName" Property="Foreground" Value="{DynamicResource Brush.SelectionSelected}"/>
                         </Trigger>
                     </ControlTemplate.Triggers>
@@ -73,6 +74,7 @@
             </Setter.Value>
         </Setter>
     </Style>
+    <!--基础按钮-->
     <Style x:Key="RadioButton.Base" TargetType="{x:Type RadioButton}">
         <Setter Property="BorderBrush" Value="{DynamicResource Brush.SelectedBorder}" />
         <Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
@@ -103,5 +105,45 @@
         </Setter>
         <Setter Property="ToolTip" Value="{Binding Content, RelativeSource={RelativeSource Self}}" />
     </Style>
-    <Style x:Key="{x:Type RadioButton}" BasedOn="{StaticResource RadioButton.Base}" TargetType="{x:Type RadioButton}" />
+    <!--<Style x:Key="{x:Type RadioButton}" BasedOn="{StaticResource RadioButton.Base}" TargetType="{x:Type RadioButton}" />-->
+    <!--主要按钮-->
+    <Style x:Key="RadioButton.Primary" TargetType="{x:Type RadioButton}">
+        <Setter Property="Background" Value="Transparent"/>
+        <Setter Property="Foreground" Value="{DynamicResource Brush.Text}"/>
+        <Setter Property="HorizontalContentAlignment" Value="Center"/>
+        <Setter Property="VerticalContentAlignment" Value="Center"/>
+        <Setter Property="Cursor" Value="Hand"/>
+        <Setter Property="FontWeight" Value="Normal"/>
+        <Setter Property="FontSize" Value="{DynamicResource FontSize.Headline}"/>
+        <Setter Property="FontFamily" Value="{DynamicResource FontFamily.Global}"/>
+        <Setter Property="Height" Value="40"/>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type RadioButton}">
+                    <Border x:Name="menuButton"  
+                            Background="{TemplateBinding Background}" 
+                            BorderThickness="{TemplateBinding BorderThickness}">
+                        <TextBlock x:Name="txtName" 
+                                   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
+                                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                                   Text="{TemplateBinding Content}" 
+                                   Foreground="{TemplateBinding Foreground}"
+                                   FontWeight="{TemplateBinding FontWeight}"
+                                   FontSize="{Binding FontSize,RelativeSource={RelativeSource TemplatedParent}}"
+                                   FontFamily="{TemplateBinding FontFamily}"/>
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter TargetName="txtName" Property="Foreground" Value="{DynamicResource Brush.ChartLine.5}"/>
+                            <Setter TargetName="menuButton" Property="Background" Value="{DynamicResource Brush.SelectionSelected}"/>
+                        </Trigger>
+                        <Trigger Property="IsChecked" Value="True">
+                            <Setter TargetName="txtName" Property="Foreground" Value="{DynamicResource Brush.SelectionSelected}"/>
+                            <Setter TargetName="menuButton" Property="Background" Value="#3A3A3A"/>
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 </ResourceDictionary>

+ 40 - 31
SKMC.UI/Styles/ScrollViewer.xaml

@@ -5,20 +5,28 @@
     </ResourceDictionary.MergedDictionaries>
     <!--滚动条两头的按钮-->
     <Style x:Key="ScrollBarButton" TargetType="{x:Type RepeatButton}">
-        <Setter Property="Background" Value="Transparent"></Setter>
-        <Setter Property="Foreground" Value="Gray"></Setter>
-        <Setter Property="VerticalAlignment" Value="Center"></Setter>
+        <Setter Property="Background" Value="Transparent"/>
+        <Setter Property="Foreground" Value="Gray"/>
+        <Setter Property="VerticalAlignment" Value="Center"/>
+        <Setter Property="HorizontalAlignment" Value="Center"/>
+        <Setter Property="Width" Value="20"/>
+        <Setter Property="Height" Value="20"/>
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type RepeatButton}">
-                    <Border>
-                        <Path x:Name="btnIcon" Data="{TemplateBinding Content}" 
+                    <Border Background="{TemplateBinding Background}">
+                        <Path x:Name="btnIcon" 
+                              Data="{TemplateBinding Content}" 
                               Fill="{TemplateBinding Foreground}" 
-                              Width="25" Height="15" Stretch="Uniform"/>
+                              Width="{TemplateBinding Width}" 
+                              Height="{TemplateBinding Height}" 
+                              Stretch="Uniform"
+                              HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
+                              VerticalAlignment="{TemplateBinding VerticalAlignment}"/>
                     </Border>
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="True">
-                            <Setter Property="Fill" Value="Red" TargetName="btnIcon"></Setter>
+                            <Setter Property="Fill" Value="{DynamicResource Brush.ButtonHover}" TargetName="btnIcon"></Setter>
                         </Trigger>
                         <Trigger Property="IsEnabled" Value="False">
                             <Setter Property="Opacity" Value="0.5" TargetName="btnIcon"/>
@@ -30,29 +38,29 @@
     </Style>
     <!--滚动条滑块两边按钮样式-->
     <Style x:Key="ScrollBarTrackButton" TargetType="{x:Type RepeatButton}">
-        <Setter Property="Background" Value="#CCCCCC"></Setter>
+        <Setter Property="Background" Value="#CCCCCC"/>
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type RepeatButton}">
-                    <Border Background="{TemplateBinding Background}"></Border>
+                    <Border Background="{TemplateBinding Background}"/>
                 </ControlTemplate>
             </Setter.Value>
         </Setter>
     </Style>
     <!--滚动条滑块样式-->
-    <ControlTemplate x:Key="ThumbTemplate" TargetType="Thumb">
-        <Border  x:Name="sliderBar" CornerRadius="3" 
-                     Margin="2" SnapsToDevicePixels="True" 
-                     Background="#505050"/>
+    <ControlTemplate x:Key="ThumbTemplate" TargetType="{x:Type Thumb}">
+        <Border x:Name="sliderBar" CornerRadius="8" 
+                SnapsToDevicePixels="True" 
+                Background="#505050"/>
         <ControlTemplate.Triggers>
             <Trigger Property="IsMouseOver" Value="True">
-                <Setter Property="Background" Value="#8E8E93" TargetName="sliderBar"></Setter>
+                <Setter Property="Background" Value="#8E8E93" TargetName="sliderBar"/>
             </Trigger>
             <Trigger Property="IsMouseOver" Value="False">
-                <Setter Property="Background" Value="#505050" TargetName="sliderBar"></Setter>
+                <Setter Property="Background" Value="#505050" TargetName="sliderBar"/>
             </Trigger>
             <Trigger Property="IsEnabled" Value="False">
-                <Setter Property="Opacity" Value="0.5" TargetName="sliderBar"></Setter>
+                <Setter Property="Opacity" Value="0.5" TargetName="sliderBar"/>
             </Trigger>
         </ControlTemplate.Triggers>
     </ControlTemplate>
@@ -70,11 +78,10 @@
             <!--左按钮-->
             <Border Grid.Column="0">
                 <RepeatButton  x:Name="HorizontalSmallDecrease" 
-                               Content="{DynamicResource Icon.ArrowLeftRight}"  
+                               Content="{DynamicResource Icon.ArrowLeft}"  
                                Style="{StaticResource ScrollBarButton}" 
-                               IsTabStop="False" Interval="50" 
-                               Width="15" Height="15"
-                               Margin="0,1,0,0" Command="ScrollBar.LineLeftCommand"/>
+                               IsTabStop="False" Interval="50"
+                               Command="ScrollBar.LineLeftCommand"/>
             </Border>
             <!--中间滑动区域-->
             <Track x:Name="PART_Track" IsDirectionReversed="False" Grid.Column="1">
@@ -94,8 +101,7 @@
                 </Track.IncreaseRepeatButton>
             </Track>
             <!--右按钮-->
-            <Border Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center"
-                    Background="#AAAAAA">
+            <Border Grid.Column="2">
                 <RepeatButton Content="{DynamicResource Icon.ArrowRight}"  
                               Style="{StaticResource ScrollBarButton}"
                               IsTabStop="False" Interval="50"
@@ -117,13 +123,13 @@
                 <RowDefinition Height="Auto" />
             </Grid.RowDefinitions>
             <!--内部背景-->
-            <Border x:Name="BgInner" Grid.Row="1" Margin="0" CornerRadius="6" SnapsToDevicePixels ="True"
+            <Border x:Name="BgInner" Grid.Row="1" CornerRadius="6" SnapsToDevicePixels ="True"
                     Background="#CCCCCC"/>
             <!--上按钮-->
-            <Border Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="VerticalSmallDecrease">
-                <RepeatButton Content="{DynamicResource arrowUp}"  
+            <Border Grid.Row="0" x:Name="VerticalSmallDecrease" Background="Transparent">
+                <RepeatButton Content="{DynamicResource Icon.ArrowUp}"  
                               Style="{StaticResource ScrollBarButton}"
-                              IsTabStop="False" Interval="50" Margin="0" 
+                              IsTabStop="False" Interval="50"
                               Command="ScrollBar.LineUpCommand"/>
             </Border>
             <!--中间滑动区域-->
@@ -141,15 +147,18 @@
                 </Track.Thumb>
                 <!--下滑块-->
                 <Track.IncreaseRepeatButton>
-                    <RepeatButton x:Name="HorizontalLargeIncrease" Command="ScrollBar.PageDownCommand"
-                                      IsTabStop="False" Interval="50" Style="{StaticResource ScrollBarTrackButton}" />
+                    <RepeatButton x:Name="HorizontalLargeIncrease" 
+                                  Command="ScrollBar.PageDownCommand"
+                                  IsTabStop="False" 
+                                  Interval="50" 
+                                  Style="{StaticResource ScrollBarTrackButton}"/>
                 </Track.IncreaseRepeatButton>
             </Track>
             <!--下按钮-->
-            <Border Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="VerticalSmallIncrease">
-                <RepeatButton Content="{DynamicResource arrowDown}" 
+            <Border Grid.Row="2" x:Name="VerticalSmallIncrease">
+                <RepeatButton Content="{DynamicResource Icon.ArrowDown}" 
                               Style="{StaticResource ScrollBarButton}"
-                              IsTabStop="False" Interval="50" Margin="0" 
+                              IsTabStop="False" Interval="50"
                               Command="ScrollBar.LineDownCommand"/>
             </Border>
         </Grid>

+ 8 - 0
SKMC.UI/Styles/TextBlock.xaml

@@ -0,0 +1,8 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+    <Style x:Key="TextBlock.Primary" TargetType="{x:Type TextBlock}">
+        <Setter Property="FontSize" Value="{DynamicResource FontSize.Callout}"/>
+        <Setter Property="FontFamily" Value="{DynamicResource FontFamily.Global}"/>
+        <Setter Property="Foreground" Value="{DynamicResource Brush.Text}"/>
+    </Style>
+</ResourceDictionary>

+ 145 - 0
SKMC.UI/Styles/TextBox.xaml

@@ -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>

+ 46 - 0
SKMC.UI/Styles/ToggleButton.xaml

@@ -0,0 +1,46 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+    <!--基础按钮-->
+    <Style x:Key="ToggleButton.Base" TargetType="{x:Type ToggleButton}">
+        <Setter Property="HorizontalContentAlignment" Value="Center"/>
+        <Setter Property="VerticalContentAlignment" Value="Center"/>
+        <Setter Property="Width" Value="100"/>
+        <Setter Property="Height" Value="40"/>
+        <Setter Property="BorderThickness" Value="0"/>
+        <Setter Property="Foreground" Value="{DynamicResource Brush.Text}"/>
+        <Setter Property="Background" Value="{DynamicResource Brush.Neutral}"/>
+        <Setter Property="FontSize" Value="{DynamicResource FontSize.Body}"/>
+        <Setter Property="Cursor" Value="Hand"/>
+    </Style>
+    <!--主要按钮-->
+    <Style x:Key="ToggleButton.Primary" 
+           TargetType="{x:Type ToggleButton}" 
+           BasedOn="{StaticResource ToggleButton.Base}">
+        <Setter Property="Background" Value="{DynamicResource Brush.PrimaryButton}"/>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type ToggleButton}">
+                    <Border Background="{TemplateBinding Background}"
+                            BorderThickness="{TemplateBinding BorderThickness}"
+                            BorderBrush="{TemplateBinding BorderBrush}">
+                        <ContentPresenter Content="{TemplateBinding Content}"
+                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter Property="Background" Value="{DynamicResource Brush.PrimaryButtonPressed}"/>
+                        </Trigger>
+                        <Trigger Property="IsPressed" Value="True">
+                            <Setter Property="Background" Value="{DynamicResource Brush.PrimaryButtonMouseOver}"/>
+                        </Trigger>
+                        <Trigger Property="IsEnabled" Value="False">
+                            <Setter Property="Background" Value="{DynamicResource Brush.PrimaryButtonDisabled}"/>
+                            <!--<Setter Property="Foreground" Value="{DynamicResource Brush.TextInactive}"/>-->
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+</ResourceDictionary>

+ 2 - 2
SKMC.UI/Themes/Dark.xaml

@@ -10,7 +10,7 @@
     <Color x:Key="Color.Text">#FFFFFF</Color>
     <Color x:Key="Color.TextContrast">#292929</Color>
     <Color x:Key="Color.TextInactive">#9C9C9C</Color>
-    <Color x:Key="Color.PreviewBackGround">#444</Color>
+    <Color x:Key="Color.PreviewBackground">#444</Color>
     <Color x:Key="Color.Label">#848484</Color>
     <Color x:Key="Color.Icon">#FFFFFF</Color>
     <Color x:Key="Color.IconInactive">#9C9C9C</Color>
@@ -19,7 +19,7 @@
     <Color x:Key="Color.SelectedBorder">#FFFFFF</Color>
     <Color x:Key="Color.SelectionDisabledBackground">#333333</Color>
 
-    <Color x:Key="Color.Signature">#00929D</Color>
+    <Color x:Key="Color.Signature">#00AFAF</Color>
     <Color x:Key="Color.SignatureLight">#CCEAEC</Color>
     <Color x:Key="Color.SignatureDark">#006D75</Color>
     <Color x:Key="Color.SignatureAccent">#00929D</Color>