Blame view

sources/RoboforkApp/Resources/ToolBar.xaml 8.88 KB
729be9a6d   doan   New Project
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
  <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib" >
  
    <ResourceDictionary.MergedDictionaries>
      <ResourceDictionary Source="Brushes.xaml" />
    </ResourceDictionary.MergedDictionaries>
    
    <Style x:Key="ToolBarButtonBaseStyle" TargetType="{x:Type ButtonBase}">
      <Setter Property="SnapsToDevicePixels" Value="true"/>
      <Setter Property="OverridesDefaultStyle" Value="true"/>
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type ButtonBase}">
            <Border 
              x:Name="Border"  
              BorderThickness="1"
              Background="Transparent"
              BorderBrush="Transparent">
              <ContentPresenter 
                Margin="2"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                RecognizesAccessKey="True"/>
            </Border>
            <ControlTemplate.Triggers>
              <Trigger Property="IsKeyboardFocused" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource SelectedBackgroundBrush}" />
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource SolidBorderBrush}" />
              </Trigger>
              <Trigger Property="IsMouseOver" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource SelectedBackgroundBrush}" />
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource SolidBorderBrush}" />
              </Trigger>
              <Trigger Property="IsPressed" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource PressedBrush}" />
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PressedBorderBrush}" />
              </Trigger>
              <Trigger Property="CheckBox.IsChecked" Value="true">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource PressedBrush}" />
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource PressedBorderBrush}" />
              </Trigger>
              <Trigger Property="IsEnabled" Value="false">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  
    <Style x:Key="{x:Static ToolBar.ButtonStyleKey}" 
           BasedOn="{StaticResource ToolBarButtonBaseStyle}"
           TargetType="{x:Type Button}"/>
    <Style x:Key="{x:Static ToolBar.ToggleButtonStyleKey}" 
           BasedOn="{StaticResource ToolBarButtonBaseStyle}"
           TargetType="{x:Type ToggleButton}"/>
    <Style x:Key="{x:Static ToolBar.CheckBoxStyleKey}" 
           BasedOn="{StaticResource ToolBarButtonBaseStyle}"
           TargetType="{x:Type CheckBox}"/>
    <Style x:Key="{x:Static ToolBar.RadioButtonStyleKey}"
           BasedOn="{StaticResource ToolBarButtonBaseStyle}"
           TargetType="{x:Type RadioButton}"/>
  
    <Style x:Key="{x:Static ToolBar.TextBoxStyleKey}" TargetType="{x:Type TextBox}">
      <Setter Property="SnapsToDevicePixels" Value="True"/>
      <Setter Property="OverridesDefaultStyle" Value="True"/>
      <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
      <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
      <Setter Property="AllowDrop" Value="true"/>
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type TextBox}">
            <Border 
              Name="Border"
              Padding="2"
              Background="{StaticResource WindowBackgroundBrush}"
              BorderBrush="{StaticResource SolidBorderBrush}"
              BorderThickness="1" >
              <ScrollViewer Margin="0" x:Name="PART_ContentHost"/>
            </Border>
            <ControlTemplate.Triggers>
              <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}"/>
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBackgroundBrush}"/>
                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  
    <Style x:Key="ToolBarThumbStyle" TargetType="{x:Type Thumb}">
      <Setter Property="OverridesDefaultStyle" Value="true"/>
      <Setter Property="Cursor" Value="SizeAll"/>
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type Thumb}">
            <Border Background="Transparent"
              SnapsToDevicePixels="True">
              <Rectangle Margin="0,2">
                <Rectangle.Fill>
                  <DrawingBrush Viewport="0,0,4,4" 
                    ViewportUnits="Absolute"
                    Viewbox="0,0,8,8"
                    ViewboxUnits="Absolute"
                    TileMode="Tile">
                    <DrawingBrush.Drawing>
                      <DrawingGroup>
                        <DrawingGroup.Children>
                          <GeometryDrawing Brush="#AAA"
                            Geometry="M 4 4 L 4 8 L 8 8 L 8 4 z"/>
                        </DrawingGroup.Children>
                      </DrawingGroup>
                    </DrawingBrush.Drawing>
                  </DrawingBrush>
                </Rectangle.Fill>
              </Rectangle>
            </Border>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  
    <Style x:Key="ToolBarOverflowButtonStyle" TargetType="{x:Type ToggleButton}">
      <Setter Property="OverridesDefaultStyle" Value="true"/>
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type ToggleButton}">
            <Border Name="Bd"
              CornerRadius="0,3,3,0"
              Background="Transparent"
              SnapsToDevicePixels="true">
              <Grid>
                <Path Name="Arrow"
                  Fill="Black"
                  VerticalAlignment="Bottom"
                  Margin="2,3"
                  Data="M -0.5 3 L 5.5 3 L 2.5 6 Z"/>
                <ContentPresenter/>
              </Grid>
            </Border>
            <ControlTemplate.Triggers>
              <Trigger Property="IsMouseOver" Value="true">
                <Setter TargetName="Bd" Property="Background" Value="{StaticResource DarkBrush}"/>
              </Trigger>
              <Trigger Property="IsKeyboardFocused" Value="true">
                <Setter TargetName="Bd" Property="Background" Value="{StaticResource DarkBrush}"/>
              </Trigger>
              <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="Bd" Property="Background" Value="{StaticResource DarkBrush}"/>
              </Trigger>
              <Trigger Property="IsEnabled" Value="false">
                <Setter TargetName="Arrow" Property="Fill" Value="#AAA"/>
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  
    <Style x:Key="{x:Type ToolBar}" TargetType="{x:Type ToolBar}">
      <Setter Property="SnapsToDevicePixels" Value="true"/>
      <Setter Property="OverridesDefaultStyle" Value="true"/>
      <Setter Property="OverflowMode" Value="Never"/>
      <Setter Property="ToolBarTray.IsLocked" Value="True"/>
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="{x:Type ToolBar}">
            <Border x:Name="Border"  
              CornerRadius="1" 
              BorderThickness="1"
              Background="{StaticResource NormalBrush}"
              BorderBrush="Gray">
              <DockPanel >                            
                <Thumb x:Name="ToolBarThumb"
                  Style="{StaticResource ToolBarThumbStyle}"
                  Width="10"/>
                <ToolBarPanel x:Name="PART_ToolBarPanel"
                  IsItemsHost="true"
                  Margin="0,1,2,2"/>
              </DockPanel>
            </Border>
            <ControlTemplate.Triggers>
              <Trigger Property="IsOverflowOpen" Value="true">
                <Setter TargetName="ToolBarThumb" Property="IsEnabled" Value="false"/>
              </Trigger>
              <Trigger Property="ToolBarTray.IsLocked" Value="true">
                <Setter TargetName="ToolBarThumb" Property="Visibility" Value="Collapsed"/>
              </Trigger>
            </ControlTemplate.Triggers>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  
    <Style x:Key="{x:Type ToolBarTray}" TargetType="{x:Type ToolBarTray}" >
      <Setter Property="Background" Value="{StaticResource HorizontalLightBrush}"/>
    </Style>
  
  </ResourceDictionary>