Skip to content

Commit

Permalink
add brush example and label style
Browse files Browse the repository at this point in the history
  • Loading branch information
NaBian committed Oct 28, 2018
1 parent f53145e commit 96c0150
Show file tree
Hide file tree
Showing 54 changed files with 375 additions and 248 deletions.
8 changes: 8 additions & 0 deletions HandyControl/HandyControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\Base\LabelBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\Base\NumericUpDownBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -340,6 +344,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\Label.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\ListBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
10 changes: 5 additions & 5 deletions HandyControl/Themes/Basic/Colors/Colors.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<Color x:Key="DangerColor">#ff8792</Color>
<Color x:Key="DarkDangerColor">#ff4c9f</Color>

<Color x:Key="WarningColor">#ffd07a</Color>
<Color x:Key="DarkWarningColor">#ff9133</Color>
<Color x:Key="WarningColor">#ffd180</Color>
<Color x:Key="DarkWarningColor">#ff9100</Color>

<Color x:Key="InfoColor">#4dd0e1</Color>
<Color x:Key="DarkInfoColor">#00bcd4</Color>
Expand All @@ -23,16 +23,16 @@
<Color x:Key="TextIconColor">White</Color>

<Color x:Key="BorderColor">#e0e0e0</Color>
<Color x:Key="SecondaryBorderColor">#a0a0a0</Color>
<Color x:Key="SecondaryBorderColor">#757575</Color>
<Color x:Key="BackgroundColor">#eeeeee</Color>
<Color x:Key="RegionColor">#ffffff</Color>
<Color x:Key="SecondaryRegionColor">#eeeeee</Color>
<Color x:Key="ThirdlyRegionColor">White</Color>
<Color x:Key="ThirdlyRegionColor">#9e9e9e</Color>
<Color x:Key="TitleColor">#73a5ff</Color>
<Color x:Key="SecondaryTitleColor">#5477f5</Color>

<Color x:Key="DefaultColor">White</Color>
<Color x:Key="DarkDefaultColor">#f4f4f4</Color>
<Color x:Key="DarkDefaultColor">#f5f5f5</Color>

<Color x:Key="AccentColor">#ff5722</Color>
<Color x:Key="DarkAccentColor">#d43f3a</Color>
Expand Down
2 changes: 1 addition & 1 deletion HandyControl/Themes/Basic/Colors/ColorsDark.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<Color x:Key="BackgroundColor">#eeeeee</Color>
<Color x:Key="RegionColor">#1c1c1c</Color>
<Color x:Key="SecondaryRegionColor">#2d2d30</Color>
<Color x:Key="ThirdlyRegionColor">#2d2d30</Color>
<Color x:Key="ThirdlyRegionColor">#424242</Color>
<Color x:Key="TitleColor">#3f3f46</Color>
<Color x:Key="SecondaryTitleColor">#2d2d30</Color>

Expand Down
38 changes: 19 additions & 19 deletions HandyControl/Themes/Basic/Paths.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,91 +5,91 @@
<ResourceDictionary Source="Geometries.xaml"/>
</ResourceDictionary.MergedDictionaries>

<Style x:Key="PathBaseStyle" TargetType="{x:Type Path}">
<Style x:Key="PathBaseStyle" TargetType="Path">
<Setter Property="Stretch" Value="Uniform"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="FlowDirection" Value="LeftToRight"/>
</Style>

<Style BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}"/>
<Style BasedOn="{StaticResource PathBaseStyle}" TargetType="Path"/>

<!--搜索-->
<Style x:Key="SearchPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="SearchPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource SearchGeometry}"/>
</Style>

<!--全屏返回-->
<Style x:Key="FullScreenReturnPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="FullScreenReturnPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource FullScreenReturnGeometry}"/>
</Style>

<!--全屏-->
<Style x:Key="FullScreenPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="FullScreenPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource FullScreenGeometry}"/>
</Style>

<!--windows-->
<Style x:Key="WindowsPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="WindowsPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource WindowsGeometry}"/>
</Style>

<!--保存-->
<Style x:Key="SavePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="SavePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource SaveGeometry}"/>
</Style>

<!--下载-->
<Style x:Key="DownloadPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="DownloadPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource DownloadGeometry}"/>
</Style>

<!--放大-->
<Style x:Key="EnlargePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="EnlargePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource EnlargeGeometry}"/>
</Style>

<!--缩小-->
<Style x:Key="ReducePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="ReducePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource ReduceGeometry}"/>
</Style>

<!--向左旋转-->
<Style x:Key="RotatePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="RotatePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource RotateLeftGeometry}"/>
</Style>

<!--日历-->
<Style x:Key="CalendarPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="CalendarPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource CalendarGeometry}"/>
</Style>

<!--删除-->
<Style x:Key="DeletePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="DeletePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource DeleteGeometry}"/>
</Style>

<!--关闭-->
<Style x:Key="ClosePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="ClosePathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource CloseGeometry}"/>
</Style>

<!---->
<Style x:Key="DownPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="DownPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource DownGeometry}"/>
</Style>

<!--时钟-->
<Style x:Key="ClockPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="ClockPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource ClockGeometry}"/>
</Style>

<!--向左-->
<Style x:Key="LeftPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="LeftPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource LeftGeometry}"/>
</Style>

<!--向右-->
<Style x:Key="RightPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="RightPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="RenderTransformOrigin" Value="0.5, 0.5"/>
<Setter Property="RenderTransform">
<Setter.Value>
Expand All @@ -105,7 +105,7 @@
</Style>

<!--向左-->
<Style x:Key="UpDownPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="{x:Type Path}">
<Style x:Key="UpDownPathStyle" BasedOn="{StaticResource PathBaseStyle}" TargetType="Path">
<Setter Property="Data" Value="{StaticResource UpDownGeometry}"/>
</Style>

Expand Down
2 changes: 1 addition & 1 deletion HandyControl/Themes/Styles/Base/BaseStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ResourceDictionary Source="../../Basic/Fonts.xaml"/>
</ResourceDictionary.MergedDictionaries>

<Style x:Key="BaseStyle" TargetType="{x:Type Control}">
<Style x:Key="BaseStyle" TargetType="Control">
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="FontSize" Value="{StaticResource TextFontSize}"/>
</Style>
Expand Down
2 changes: 1 addition & 1 deletion HandyControl/Themes/Styles/Base/ButtonBaseBaseStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
</ResourceDictionary.MergedDictionaries>

<Style x:Key="ButtonBaseBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="{x:Type ButtonBase}">
<Style x:Key="ButtonBaseBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="ButtonBase">
<Setter Property="Height" Value="{StaticResource DefaultControlHeight}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
Expand Down
5 changes: 3 additions & 2 deletions HandyControl/Themes/Styles/Base/ButtonBaseStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
<ResourceDictionary Source="ButtonBaseBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>

<Style x:Key="ButtonBaseStyle" BasedOn="{StaticResource ButtonBaseBaseStyle}" TargetType="{x:Type Button}">
<Style x:Key="ButtonBaseStyle" BasedOn="{StaticResource ButtonBaseBaseStyle}" TargetType="Button">
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<ControlTemplate TargetType="Button">
<Grid>
<Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"/>
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
Expand Down
6 changes: 3 additions & 3 deletions HandyControl/Themes/Styles/Base/ComboBoxBaseStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@
</ControlTemplate.Triggers>
</ControlTemplate>

<Style x:Key="ComboBoxItemBaseStyle" TargetType="{x:Type ComboBoxItem}">
<Style x:Key="ComboBoxItemBaseStyle" TargetType="ComboBoxItem">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Padding" Value="9,6"/>
<Setter Property="Background" Value="Transparent"/>
Expand All @@ -477,7 +477,7 @@
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
<ControlTemplate TargetType="ComboBoxItem">
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
Expand All @@ -502,7 +502,7 @@
</Setter>
</Style>

<Style x:Key="ComboBoxBaseStyle" TargetType="{x:Type ComboBox}">
<Style x:Key="ComboBoxBaseStyle" TargetType="ComboBox">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItemBaseStyle}"/>
Expand Down
14 changes: 7 additions & 7 deletions HandyControl/Themes/Styles/Base/ContextMenuBaseStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</ResourceDictionary.MergedDictionaries>

<!--普通菜单项-->
<Style x:Key="MenuItemBaseStyle" TargetType="{x:Type MenuItem}">
<Style x:Key="MenuItemBaseStyle" TargetType="MenuItem">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
Expand All @@ -16,7 +16,7 @@
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Bd" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Uid="Border_38">
<Grid x:Name="Grid" Uid="Grid_49">
<Grid.ColumnDefinitions>
Expand Down Expand Up @@ -52,7 +52,7 @@
<Setter Property="Height" Value="28"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<ControlTemplate TargetType="MenuItem">
<Border MinWidth="44" Height="{TemplateBinding Height}" x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
Expand Down Expand Up @@ -111,7 +111,7 @@
<Setter Property="Height" Value="28"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<ControlTemplate TargetType="MenuItem">
<Border Padding="{TemplateBinding Padding}" x:Name="templateRoot" Height="{TemplateBinding Height}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid>
<Grid.ColumnDefinitions>
Expand Down Expand Up @@ -164,7 +164,7 @@
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type MenuItem}">
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Bd" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Uid="Border_42">
<Grid x:Name="Grid" Uid="Grid_50">
<Grid.ColumnDefinitions>
Expand Down Expand Up @@ -208,12 +208,12 @@
</Style>

<!--普通菜单-->
<Style x:Key="ContextMenuBaseStyle" TargetType="{x:Type ContextMenu}">
<Style x:Key="ContextMenuBaseStyle" TargetType="ContextMenu">
<Setter Property="MaxHeight" Value="199"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContextMenu}">
<ControlTemplate TargetType="ContextMenu">
<Border Background="{TemplateBinding Background}" CornerRadius="2" MaxHeight="{TemplateBinding MaxHeight}" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
<controls:ScrollViewer Margin="0,6" VerticalScrollBarVisibility="Auto">
<ItemsPresenter/>
Expand Down
35 changes: 35 additions & 0 deletions HandyControl/Themes/Styles/Base/LabelBaseStyle.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
</ResourceDictionary.MergedDictionaries>

<Style x:Key="LabelBaseStyle" TargetType="Label">
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
<Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Label">
<Border CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</Style.Triggers>
</Style>

</ResourceDictionary>
Loading

0 comments on commit 96c0150

Please sign in to comment.