add ToolBar style

This commit is contained in:
NaBian 2018-11-21 18:58:20 +08:00
parent 9b839a1532
commit 225d2fa9cd
19 changed files with 319 additions and 9 deletions

View File

@ -267,6 +267,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\Base\ToolBarBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\GroupBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -507,6 +511,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\ToolBar.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\ToolTip.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -32,5 +32,6 @@
<Geometry x:Key="FatalGeometry">M716.8 375.466667l34.133333 34.133333c17.066667 17.066667 42.666667 17.066667 59.733334 0 17.066667-17.066667 17.066667-42.666667 0-59.733333l-34.133334-34.133334 34.133334-34.133333c17.066667-17.066667 17.066667-42.666667 0-59.733333-17.066667-17.066667-42.666667-17.066667-59.733334 0l-34.133333 34.133333-34.133333-34.133333c-17.066667-17.066667-42.666667-17.066667-59.733334 0-17.066667 17.066667-17.066667 42.666667 0 59.733333l34.133334 34.133333-34.133334 34.133334c-17.066667 17.066667-17.066667 42.666667 0 59.733333 17.066667 17.066667 42.666667 17.066667 59.733334 0l34.133333-34.133333z m-426.666667 0l34.133334 34.133333c17.066667 17.066667 42.666667 17.066667 59.733333 0 17.066667-17.066667 17.066667-42.666667 0-59.733333l-34.133333-34.133334 34.133333-34.133333c17.066667-17.066667 17.066667-42.666667 0-59.733333-17.066667-17.066667-42.666667-17.066667-59.733333 0l-34.133334 34.133333-34.133333-34.133333c-17.066667-17.066667-42.666667-17.066667-59.733333 0-17.066667 17.066667-17.066667 42.666667 0 59.733333l34.133333 34.133333-34.133333 34.133334c-17.066667 17.066667-17.066667 42.666667 0 59.733333 17.066667 17.066667 42.666667 17.066667 59.733333 0l34.133333-34.133333zM0 85.333333c0-51.2 42.666667-85.333333 85.333333-85.333333h853.333334c51.2 0 85.333333 42.666667 85.333333 85.333333v853.333334c0 51.2-42.666667 85.333333-85.333333 85.333333H85.333333c-51.2 0-85.333333-42.666667-85.333333-85.333333V85.333333z m512 469.333334c-136.533333 0-230.4 68.266667-290.133333 196.266666-8.533333 17.066667 0 42.666667 17.066666 59.733334s42.666667 0 59.733334-17.066667c51.2-93.866667 110.933333-145.066667 221.866666-145.066667 102.4 0 170.666667 51.2 221.866667 145.066667 8.533333 17.066667 34.133333 25.6 59.733333 17.066667 17.066667-8.533333 25.6-34.133333 17.066667-59.733334-76.8-128-170.666667-196.266667-307.2-196.266666z</Geometry>
<Geometry x:Key="AskGeometry">M512 0 30.11843 240.941297l0 542.117406 481.88157 240.941297 481.88157-240.941297L993.88157 240.941297 512 0zM575.776472 768.799969 460.188012 768.799969 460.188012 656.222073l115.588459 0L575.776472 768.799969zM623.335603 509.329685c-52.375829 36.723353-59.600363 55.988096-59.600363 84.885211l0 19.866447L468.616977 614.081343l0-26.489278c0-45.754021 13.846342-80.67124 61.406497-116.791866 46.957428-36.723353 57.79423-62.0082 57.79423-84.282484 0-25.284848-21.67258-54.181962-55.386393-54.181962-42.743457 0-70.436142 26.489278-82.477374 85.486914l-105.956088-21.67258c24.683144-111.976192 82.477374-157.127486 205.289345-157.127486 98.12985 0 157.72919 63.212631 157.72919 131.842639C707.017407 423.240044 688.956071 461.76953 623.335603 509.329685z</Geometry>
<Geometry x:Key="AllGeometry">M 721.005 638.949 C 758.74 638.949 789.333 669.56 789.333 707.312 C 789.333 745.047 758.74 775.657 721.005 775.657 C 683.253 775.657 652.66 745.047 652.66 707.312 C 652.66 669.56 683.253 638.949 721.005 638.949 Z M 512.017 638.949 C 549.77 638.949 580.38 669.56 580.38 707.312 C 580.38 745.047 549.77 775.657 512.017 775.657 C 474.265 775.657 443.672 745.047 443.672 707.312 C 443.672 669.56 474.265 638.949 512.017 638.949 Z M 303.029 638.949 C 340.781 638.949 371.392 669.56 371.392 707.312 C 371.392 745.047 340.781 775.657 303.029 775.657 C 265.277 775.657 234.667 745.047 234.667 707.312 C 234.667 669.56 265.277 638.949 303.029 638.949 Z M 721.005 443.655 C 758.74 443.655 789.333 474.265 789.333 512.017 C 789.333 549.769 758.74 580.363 721.005 580.363 C 683.253 580.363 652.66 549.769 652.66 512.017 C 652.66 474.265 683.253 443.655 721.005 443.655 Z M 512.017 443.655 C 549.77 443.655 580.38 474.265 580.38 512.017 C 580.38 549.769 549.77 580.363 512.017 580.363 C 474.265 580.363 443.672 549.769 443.672 512.017 C 443.672 474.265 474.265 443.655 512.017 443.655 Z M 303.029 443.655 C 340.781 443.655 371.392 474.265 371.392 512.017 C 371.392 549.769 340.781 580.363 303.029 580.363 C 265.277 580.363 234.667 549.769 234.667 512.017 C 234.667 474.265 265.277 443.655 303.029 443.655 Z M 721.005 248.343 C 758.74 248.343 789.333 278.953 789.333 316.688 C 789.333 354.44 758.74 385.051 721.005 385.051 C 683.253 385.051 652.66 354.44 652.66 316.688 C 652.66 278.953 683.253 248.343 721.005 248.343 Z M 512.017 248.343 C 549.77 248.343 580.38 278.953 580.38 316.688 C 580.38 354.44 549.77 385.051 512.017 385.051 C 474.265 385.051 443.672 354.44 443.672 316.688 C 443.672 278.953 474.265 248.343 512.017 248.343 Z M 303.029 248.343 C 340.781 248.343 371.392 278.953 371.392 316.688 C 371.392 354.44 340.781 385.051 303.029 385.051 C 265.277 385.051 234.667 354.44 234.667 316.688 C 234.667 278.953 265.277 248.343 303.029 248.343 Z</Geometry>
<Geometry x:Key="DragGeometry">M384 896C384 825.307552 440.814697 768 512 768 582.692448 768 640 824.814694 640 896 640 966.692448 583.185303 1024 512 1024 441.307552 1024 384 967.185306 384 896ZM384 512C384 441.307552 440.814697 384 512 384 582.692448 384 640 440.814697 640 512 640 582.692448 583.185303 640 512 640 441.307552 640 384 583.185303 384 512ZM384 128C384 57.307552 440.814697 0 512 0 582.692448 0 640 56.814697 640 128 640 198.692448 583.185303 256 512 256 441.307552 256 384 199.185303 384 128Z</Geometry>
</ResourceDictionary>

View File

@ -53,7 +53,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border MinWidth="44" Height="{TemplateBinding Height}" x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border MinWidth="44" Height="{TemplateBinding Height}" x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
@ -88,7 +88,7 @@
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource DarkDefaultBrush}"/>
<Setter Property="TextElement.Foreground" TargetName="menuHeaderContainer" Value="{DynamicResource PrimaryTextBrush}"/>
</Trigger>
<Trigger Property="IsSubmenuOpen" Value="True">
@ -130,7 +130,7 @@
<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="Background" TargetName="templateRoot" Value="{DynamicResource DarkDefaultBrush}"/>
<Setter Property="TextElement.Foreground" TargetName="menuHeaderContainer" Value="{DynamicResource PrimaryTextBrush}"/>
</Trigger>
<Trigger Property="IsSubmenuOpen" Value="True">
@ -216,4 +216,24 @@
</Setter>
</Style>
<Style x:Key="MenuBaseStyle" TargetType="Menu">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontStyle" Value="Normal"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="ItemContainerStyle" Value="{StaticResource MenuItemBaseStyle}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Menu">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@ -0,0 +1,161 @@
<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/Geometries.xaml"/>
<ResourceDictionary Source="../Button.xaml"/>
<ResourceDictionary Source="../CheckBox.xaml"/>
<ResourceDictionary Source="../RadioButton.xaml"/>
<ResourceDictionary Source="../ComboBox.xaml"/>
<ResourceDictionary Source="../TextBox.xaml"/>
<ResourceDictionary Source="../ContextMenu.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="{x:Static ToolBar.SeparatorStyleKey}" TargetType="Separator">
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Width" Value="1"/>
</Style>
<!--Styles for controls in a toolbar.-->
<Style x:Key="ToolBarTrayBaseStyle" TargetType="ToolBarTray">
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style x:Key="{x:Static ToolBar.ButtonStyleKey}" BasedOn="{StaticResource ButtonBaseStyle}" TargetType="Button">
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource DarkDefaultBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="{x:Static ToolBar.CheckBoxStyleKey}" BasedOn="{StaticResource CheckBoxBaseStyle}" TargetType="CheckBox"/>
<Style x:Key="{x:Static ToolBar.RadioButtonStyleKey}" BasedOn="{StaticResource RadioButtonBaseStyle}" TargetType="RadioButton"/>
<Style x:Key="{x:Static ToolBar.ComboBoxStyleKey}" BasedOn="{StaticResource ComboBoxBaseStyle}" TargetType="ComboBox"/>
<Style x:Key="{x:Static ToolBar.TextBoxStyleKey}" BasedOn="{StaticResource TextBoxBaseStyle}" TargetType="TextBox"/>
<Style x:Key="{x:Static ToolBar.MenuStyleKey}" BasedOn="{StaticResource MenuBaseStyle}" TargetType="Menu"/>
<Style x:Key="ToolBarThumbStyle" TargetType="Thumb">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Border SnapsToDevicePixels="True" Padding="{TemplateBinding Padding}" Background="Transparent">
<Path Stretch="Uniform" Width="4" Fill="{DynamicResource PrimaryBrush}" Data="{StaticResource DragGeometry}" SnapsToDevicePixels="True"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Cursor" Value="SizeAll"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ToolBarVerticalOverflowButtonStyle" TargetType="ToggleButton">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="MinHeight" Value="0"/>
<Setter Property="MinWidth" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="Bd" SnapsToDevicePixels="true" CornerRadius="4" Background="{TemplateBinding Background}">
<Path x:Name="PathMore" Data="{StaticResource DownGeometry}" Width="8" Margin="4,4,4,8" VerticalAlignment="Bottom" Fill="{DynamicResource PrimaryTextBrush}" Stretch="Uniform" SnapsToDevicePixels="True"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="PathMore" Value="{DynamicResource PrimaryBrush}"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="Fill" TargetName="PathMore" Value="{DynamicResource PrimaryBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ToolBarHorizontalOverflowButtonStyle" TargetType="ToggleButton">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="MinHeight" Value="0"/>
<Setter Property="MinWidth" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="Bd" SnapsToDevicePixels="true" CornerRadius="4" Background="{TemplateBinding Background}">
<Path x:Name="PathMore" Data="{StaticResource DownGeometry}" Width="8" Margin="4,4,4,8" VerticalAlignment="Bottom" Fill="{DynamicResource PrimaryTextBrush}" Stretch="Uniform" SnapsToDevicePixels="True"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Fill" TargetName="PathMore" Value="{DynamicResource PrimaryBrush}"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="Fill" TargetName="PathMore" Value="{DynamicResource PrimaryBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Visibility" Value="Collapsed"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ToolBarBaseStyle" TargetType="ToolBar">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
<Setter Property="Margin" Value="0,0,4,4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToolBar">
<Grid x:Name="Grid" SnapsToDevicePixels="true">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid x:Name="OverflowGrid" Grid.Column="1">
<ToggleButton Margin="4,0,0,0" x:Name="OverflowButton" ClickMode="Press" FocusVisualStyle="{x:Null}" IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{TemplateBinding HasOverflowItems}" Style="{StaticResource ToolBarHorizontalOverflowButtonStyle}"/>
<Popup x:Name="OverflowPopup" AllowsTransparency="true" Focusable="false" IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom" StaysOpen="false">
<Border x:Name="ToolBarSubMenuBorder" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Background="{DynamicResource RegionBrush}" RenderOptions.ClearTypeHint="Enabled">
<ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel" KeyboardNavigation.DirectionalNavigation="Cycle" FocusVisualStyle="{x:Null}" Focusable="true" Margin="6" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle" WrapWidth="200"/>
</Border>
</Popup>
</Grid>
<Border x:Name="MainPanelBorder" Grid.Column="0" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
<DockPanel KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local">
<Thumb x:Name="ToolBarThumb" Style="{StaticResource ToolBarThumbStyle}" Width="10"/>
<ContentPresenter x:Name="ToolBarHeader" ContentSource="Header" HorizontalAlignment="Center" Margin="4,0,4,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
<ToolBarPanel x:Name="PART_ToolBarPanel" IsItemsHost="true" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</DockPanel>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsOverflowOpen" Value="true">
<Setter Property="IsEnabled" TargetName="ToolBarThumb" Value="false"/>
</Trigger>
<Trigger Property="Header" Value="{x:Null}">
<Setter Property="Visibility" TargetName="ToolBarHeader" Value="Collapsed"/>
</Trigger>
<Trigger Property="ToolBarTray.IsLocked" Value="true">
<Setter Property="Visibility" TargetName="ToolBarThumb" Value="Collapsed"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@ -11,4 +11,6 @@
<!--默认普通菜单项-->
<Style BasedOn="{StaticResource MenuItemBaseStyle}" TargetType="MenuItem"/>
<Style BasedOn="{StaticResource MenuBaseStyle}" TargetType="Menu"/>
</ResourceDictionary>

View File

@ -43,6 +43,7 @@
<ResourceDictionary Source="GroupBox.xaml"/>
<ResourceDictionary Source="ListView.xaml"/>
<ResourceDictionary Source="RichTextBox.xaml"/>
<ResourceDictionary Source="ToolBar.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@ -0,0 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base/ToolBarBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource ToolBarTrayBaseStyle}" TargetType="ToolBarTray"/>
<Style BasedOn="{StaticResource ToolBarBaseStyle}" TargetType="ToolBar"/>
</ResourceDictionary>

View File

@ -100,6 +100,8 @@
public static readonly string RichTextBoxDemoCtl = nameof(RichTextBoxDemoCtl);
public static readonly string ToolBarDemoCtl = nameof(ToolBarDemoCtl);
public static readonly string CommonWindow = nameof(CommonWindow);
public static readonly string CustomNonClientAreaWindow = nameof(CustomNonClientAreaWindow);

View File

@ -55,7 +55,8 @@ var styleList = new List<string>
"SliderDemoCtl",
"GroupBoxDemoCtl",
"ListViewDemoCtl",
"RichTextBoxDemoCtl"
"RichTextBoxDemoCtl",
"ToolBarDemoCtl"
};
var windowList = new List<string>
{

View File

@ -252,6 +252,9 @@
<Compile Include="UserControl\Styles\ToggleButtonDemoCtl.xaml.cs">
<DependentUpon>ToggleButtonDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="UserControl\Styles\ToolBarDemoCtl.xaml.cs">
<DependentUpon>ToolBarDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="UserControl\Styles\TreeViewDemoCtl.xaml.cs">
<DependentUpon>TreeViewDemoCtl.xaml</DependentUpon>
</Compile>
@ -538,6 +541,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControl\Styles\ToolBarDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControl\Styles\TreeViewDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -578,6 +585,7 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput>
</Content>
<Resource Include="Resources\Img\LeftMainContent\ToolBar_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\RichTextBox_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ListView_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\GroupBox_16x.png" />

View File

@ -906,6 +906,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 工具条 的本地化字符串。
/// </summary>
public static string ToolBar {
get {
return ResourceManager.GetString("ToolBar", resourceCulture);
}
}
/// <summary>
/// 查找类似 树视图 的本地化字符串。
/// </summary>

View File

@ -411,4 +411,7 @@
<data name="ListView" xml:space="preserve">
<value>ListView</value>
</data>
<data name="ToolBar" xml:space="preserve">
<value>ToolBar</value>
</data>
</root>

View File

@ -394,4 +394,7 @@
<data name="RichTextBox" xml:space="preserve">
<value>富文本框</value>
</data>
<data name="ToolBar" xml:space="preserve">
<value>工具条</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

View File

@ -110,7 +110,7 @@
<Image Source="../../Resources/Img/LeftMainContent/ListBox_16x.png"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.ListViewDemoCtl}" Content="{x:Static langs:Lang.ListView}">
<ListBoxItem Tag="{x:Static data:MessageToken.ListViewDemoCtl}" Content="{x:Static langs:Lang.ListView}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/ListView_16x.png"/>
</controls:EdgeElement.LeftContent>
@ -130,6 +130,11 @@
<Image Source="../../Resources/Img/LeftMainContent/RichTextBox_16x.png"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.ToolBarDemoCtl}" Content="{x:Static langs:Lang.ToolBar}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/ToolBar_16x.png"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.BorderDemoCtl}" Content="{x:Static langs:Lang.Border1}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/BorderElement_16x.png"/>

View File

@ -0,0 +1,61 @@
<UserControl x:Class="HandyControlDemo.UserControl.ToolBarDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
DataContext="{Binding ComboBoxDemo,Source={StaticResource Locator}}"
Background="{DynamicResource RegionBrush}">
<controls:TransitioningContentControl>
<ToolBarTray Margin="32" VerticalAlignment="Center">
<ToolBar Padding="6" Header="{x:Static langs:Lang.Title}">
<CheckBox IsChecked="True" Margin="10,0,0,0"/>
<Separator Margin="10,0,0,0"/>
<RadioButton Margin="10,0,0,0"/>
<StackPanel Orientation="Horizontal">
<RadioButton IsChecked="True" Margin="10,0,0,0"/>
<RadioButton Margin="10,0,0,0"/>
</StackPanel>
<Button Content="{x:Static langs:Lang.Button}" Margin="10,0,0,0"/>
<Button Content="{x:Static langs:Lang.Button}" Margin="10,0,0,0" Style="{StaticResource ButtonPrimary}"/>
</ToolBar>
<ToolBar Band="1" Padding="6">
<ComboBox ItemsSource="{Binding DataList}" SelectedIndex="0" Width="230"/>
<TextBox Text="{Binding Source={x:Static langs:Lang.Text},Converter={StaticResource StringRepeatConverter},ConverterParameter=4,Mode=OneWay}" Margin="10,0,0,0" Width="230"/>
</ToolBar>
<ToolBar Band="0" Padding="6">
<Menu Background="Transparent" VerticalAlignment="Center">
<MenuItem Header="{x:Static langs:Lang.Repository}">
<MenuItem Header="GitHub">
<MenuItem.Icon>
<Path Data="{StaticResource GithubGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="NuGet">
<MenuItem.Icon>
<Path Data="{StaticResource NugetGeometry}" Fill="#224880"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Header="{x:Static langs:Lang.About}">
<MenuItem Header="{x:Static langs:Lang.Email}">
<MenuItem.Icon>
<Path Data="{StaticResource EmailGeometry}" Fill="{DynamicResource PrimaryBrush}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{x:Static langs:Lang.Chatroom}">
<MenuItem.Icon>
<Path Data="{StaticResource GitterGeometry}" Fill="#e52e64"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{x:Static langs:Lang.Blog}">
<MenuItem.Icon>
<Path Data="{StaticResource CnblogsGeometry}" Fill="{DynamicResource PrimaryTextBrush}"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Header="{x:Static langs:Lang.Contributors}"/>
</Menu>
</ToolBar>
</ToolBarTray>
</controls:TransitioningContentControl>
</UserControl>

View File

@ -0,0 +1,10 @@
namespace HandyControlDemo.UserControl
{
public partial class ToolBarDemoCtl
{
public ToolBarDemoCtl()
{
InitializeComponent();
}
}
}

View File

@ -6,19 +6,23 @@
## Latest examples
### 1、Slider
### 1、ToolBar
![ToolBar](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/ToolBar.png)
### 2、Slider
![Slider](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/Slider.png)
### 2、CircleProgressBar
### 3、CircleProgressBar
![CircleProgressBar](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/CircleProgressBar.png)
### 3、DataGrid
### 4、DataGrid
![DataGrid](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/DataGrid.png)
### 4、Now you can switch to dark theme
### 5、Now you can switch to dark theme
![dark theme](https://raw.githubusercontent.com/NaBian/HandyControl/master/Resources/DarkTheme.png)

BIN
Resources/ToolBar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB