123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <ToolBar Style="{DynamicResource ToolBarStyle1}" x:Class="CustomControls.ToolStrip"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="clr-namespace:CustomControls">
- <ToolBar.Resources>
- <LinearGradientBrush x:Key="ToolBarHorizontalBackground" EndPoint="0,1" StartPoint="0,0">
- <GradientStop Color="#FFFCFCFC" Offset="0.0"/>
- <GradientStop Color="#FFF2F2F2" Offset="1.0"/>
- </LinearGradientBrush>
- <LinearGradientBrush x:Key="ToolBarVerticalBackground" EndPoint="1,0" StartPoint="0,0">
- <GradientStop Color="#FFFCFCFC" Offset="0.0"/>
- <GradientStop Color="#FFF2F2F2" Offset="1.0"/>
- </LinearGradientBrush>
- <SolidColorBrush x:Key="ToolBarGripDark" Color="#FF6D6D6D"/>
- <SolidColorBrush x:Key="ToolBarGripLight" Color="#FFFFFFFF"/>
- <Style x:Key="ToolBarThumbStyle" TargetType="{x:Type Thumb}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Thumb}">
- <Border Background="Transparent" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
- <Rectangle>
- <Rectangle.Fill>
- <DrawingBrush TileMode="Tile" ViewboxUnits="Absolute" Viewbox="0,0,5,5" ViewportUnits="Absolute" Viewport="0,0,5,5">
- <DrawingBrush.Drawing>
- <DrawingGroup>
- <GeometryDrawing Brush="{DynamicResource ToolBarGripLight}" Geometry="M 1 1 L 1 3 L 3 3 L 3 1 z"/>
- <GeometryDrawing Brush="{DynamicResource ToolBarGripDark}" Geometry="M 0 0 L 0 2 L 2 2 L 2 0 z"/>
- </DrawingGroup>
- </DrawingBrush.Drawing>
- </DrawingBrush>
- </Rectangle.Fill>
- </Rectangle>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter Property="Cursor" Value="SizeAll"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="ToolBarStyle1" TargetType="{x:Type local:ToolStrip}">
- <Setter Property="Background" Value="{DynamicResource ToolBarHorizontalBackground}"/>
- <Setter Property="Padding" Value="2"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type local:ToolStrip}">
- <Border x:Name="MainPanelBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" CornerRadius="3">
- <DockPanel x:Name="dockPanel" KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local" VerticalAlignment="Center">
- <Thumb x:Name="ToolBarThumb" Margin="-2,0,0,0" Padding="6,2,2,2" Style="{StaticResource ToolBarThumbStyle}" Width="12"/>
- <local:CustomToolBarPanel x:Name="PART_ToolBarPanel" IsItemsHost="true" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
- </DockPanel>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="ToolBarTray.IsLocked" Value="true">
- <Setter Property="Visibility" TargetName="ToolBarThumb" Value="Collapsed"/>
- </Trigger>
- <Trigger Property="GripVisible" Value="False">
- <Setter Property="Visibility" TargetName="ToolBarThumb" Value="Collapsed"/>
- <Setter Property="CornerRadius" TargetName="MainPanelBorder" Value="0"/>
- </Trigger>
- <Trigger Property="Vertical" Value="true">
- <Setter Property="Orientation" TargetName="PART_ToolBarPanel" Value="Vertical"/>
- <Setter Property="VerticalAlignment" TargetName="dockPanel" Value="Top"/>
- <Setter Property="HorizontalAlignment" TargetName="dockPanel" Value="Center"/>
- <Setter Property="Height" TargetName="ToolBarThumb" Value="10"/>
- <Setter Property="Width" TargetName="ToolBarThumb" Value="Auto"/>
- <Setter Property="Margin" TargetName="ToolBarThumb" Value="-1,-3,0,0"/>
- <Setter Property="Padding" TargetName="ToolBarThumb" Value="5,6,6,1"/>
- <Setter Property="Margin" TargetName="PART_ToolBarPanel" Value="0,2,0,0"/>
- <Setter Property="DockPanel.Dock" TargetName="ToolBarThumb" Value="Top"/>
- <Setter Property="Background" Value="{DynamicResource ToolBarVerticalBackground}"/>
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ToolBar.Resources>
- </ToolBar>
|