PageRenderTime 36ms CodeModel.GetById 17ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 1ms

/CBR/CBR/Resources/XAML/Controls/Buttons.xaml

#
XAML | 292 lines | 283 code | 9 blank | 0 comment | 0 complexity | d6dac573bff07feff379a95b48555d72 MD5 | raw file
  1<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3                    xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent">
  4
  5    <ControlTemplate x:Key="CBROnWhiteButtonControlTemplate" TargetType="{x:Type Button}">
  6        <Border x:Name="border" BorderThickness="1" CornerRadius="2" Height="Auto"
  7			Background="#FFFBFBFC" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
  8        	<Border.BitmapEffect>
  9        		<DropShadowBitmapEffect ShadowDepth="2" Softness="0.2" Color="#FF2F2F2F"></DropShadowBitmapEffect>     	
 10			</Border.BitmapEffect>
 11        	<Border.BorderBrush>
 12        		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
 13        			<GradientStop Color="#FFDEDFE0" Offset="0"/>
 14        			<GradientStop Color="#FFA1A2A4" Offset="1"/>
 15        		</LinearGradientBrush>
 16        	</Border.BorderBrush>
 17            <Border x:Name="border1" Height="Auto" BorderBrush="{DynamicResource TransparentBrush}" BorderThickness="1" CornerRadius="2"
 18				Background="{DynamicResource TransparentBrush}">
 19                <Grid Height="Auto">
 20                    <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
 21                        <Rectangle.Fill>
 22                            <RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
 23                                <GradientStop Color="#7FFFFFFF" Offset="0"/>
 24                                <GradientStop Offset="1"/>
 25                            </RadialGradientBrush>
 26                        </Rectangle.Fill>
 27                    </Rectangle>
 28                    <Grid>
 29                        <ContentPresenter x:Name="content" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
 30							VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="True">
 31                        </ContentPresenter>
 32                    </Grid>
 33                </Grid>
 34            </Border>
 35        </Border>
 36        <ControlTemplate.Triggers>
 37            <Trigger Property="IsPressed" Value="True">
 38                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonPressedOuterBorderBrush}"/>
 39                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonPressedOuterBackgroundBrush}"/>
 40                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBackgroundBrush}"/>
 41                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBorderBrush}"/>
 42            </Trigger>
 43            <Trigger Property="IsEnabled" Value="False">
 44                <Setter Property="Opacity" TargetName="content" Value="0.5"/>
 45                <Setter Property="Effect" TargetName="content">
 46                    <Setter.Value>
 47                        <Fluent:GrayscaleEffect/>
 48                    </Setter.Value>
 49                </Setter>
 50            </Trigger>
 51            <MultiTrigger>
 52                <MultiTrigger.Conditions>
 53                    <Condition Property="IsMouseOver" Value="True"/>
 54                    <Condition Property="IsPressed" Value="False"/>
 55                    <Condition Property="IsEnabled" Value="True"/>
 56                </MultiTrigger.Conditions>
 57                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
 58                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
 59                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
 60                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
 61                <Setter Property="Visibility" TargetName="rectangle" Value="Visible"/>
 62            </MultiTrigger>
 63            <MultiTrigger>
 64                <MultiTrigger.Conditions>
 65                    <Condition Property="IsKeyboardFocusWithin" Value="True"/>
 66                    <Condition Property="IsPressed" Value="False"/>
 67                </MultiTrigger.Conditions>
 68                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
 69                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
 70                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
 71                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
 72            </MultiTrigger>
 73        </ControlTemplate.Triggers>
 74    </ControlTemplate>
 75
 76    <Style x:Key="CBROnWhiteButtonStyle" TargetType="{x:Type Button}">
 77        <Setter Property="MinHeight" Value="26"/>
 78        <Setter Property="HorizontalContentAlignment" Value="Center"/>
 79		<Setter Property="VerticalContentAlignment" Value="Center"/>
 80        <Setter Property="Template" Value="{StaticResource CBROnWhiteButtonControlTemplate}"/>
 81        <Setter Property="OverridesDefaultStyle" Value="True"/>
 82        <Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
 83        <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
 84        <Setter Property="SnapsToDevicePixels" Value="False"/>
 85    </Style>
 86    
 87    <ControlTemplate x:Key="CBRButtonControlTemplate" TargetType="{x:Type Button}">
 88        <Border x:Name="border" BorderThickness="1" CornerRadius="2" Background="{DynamicResource TransparentBrush}" BorderBrush="{DynamicResource TransparentBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
 89            <Border x:Name="border1" Height="Auto" BorderBrush="{DynamicResource TransparentBrush}" BorderThickness="1" CornerRadius="2" Background="{DynamicResource TransparentBrush}">
 90                <Grid Height="Auto">
 91                    <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
 92                        <Rectangle.Fill>
 93                            <RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
 94                                <GradientStop Color="#7FFFFFFF" Offset="0"/>
 95                                <GradientStop Offset="1"/>
 96                            </RadialGradientBrush>
 97                        </Rectangle.Fill>
 98                    </Rectangle>
 99                    <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Horizontal">
100                        <ContentPresenter x:Name="content" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" 
101                                          SnapsToDevicePixels="True">
102                        </ContentPresenter>
103                    </StackPanel>
104                </Grid>
105            </Border>
106        </Border>
107        <ControlTemplate.Triggers>
108            <Trigger Property="IsPressed" Value="True">
109                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonPressedOuterBorderBrush}"/>
110                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonPressedOuterBackgroundBrush}"/>
111                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBackgroundBrush}"/>
112                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBorderBrush}"/>
113            </Trigger>
114            <Trigger Property="IsEnabled" Value="False">
115                <Setter Property="Opacity" TargetName="content" Value="0.5"/>
116                <Setter Property="Effect" TargetName="content">
117                    <Setter.Value>
118                        <Fluent:GrayscaleEffect/>
119                    </Setter.Value>
120                </Setter>
121            </Trigger>
122            <MultiTrigger>
123                <MultiTrigger.Conditions>
124                    <Condition Property="IsMouseOver" Value="True"/>
125                    <Condition Property="IsPressed" Value="False"/>
126                    <Condition Property="IsEnabled" Value="True"/>
127                </MultiTrigger.Conditions>
128                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
129                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
130                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
131                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
132                <Setter Property="Visibility" TargetName="rectangle" Value="Visible"/>
133            </MultiTrigger>
134            <MultiTrigger>
135                <MultiTrigger.Conditions>
136                    <Condition Property="IsKeyboardFocusWithin" Value="True"/>
137                    <Condition Property="IsPressed" Value="False"/>
138                </MultiTrigger.Conditions>
139                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
140                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
141                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
142                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
143            </MultiTrigger>
144        </ControlTemplate.Triggers>
145    </ControlTemplate>
146
147    <Style x:Key="CBRButtonStyle" TargetType="{x:Type Button}">
148        <Setter Property="Template" Value="{StaticResource CBRButtonControlTemplate}"/>
149        <Setter Property="OverridesDefaultStyle" Value="True"/>
150        <Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
151        <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
152        <Setter Property="SnapsToDevicePixels" Value="False"/>
153    </Style>
154
155    <ControlTemplate x:Key="CBRToggleButtonControlTemplate" TargetType="{x:Type ToggleButton}">
156        <Border x:Name="border" BorderThickness="1" CornerRadius="2" Background="{DynamicResource TransparentBrush}" BorderBrush="{DynamicResource TransparentBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
157            <Border x:Name="border1" Height="Auto" BorderBrush="{DynamicResource TransparentBrush}" BorderThickness="1" CornerRadius="2" Background="{DynamicResource TransparentBrush}">
158                <Grid Height="Auto">
159                    <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
160                        <Rectangle.Fill>
161                            <RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
162                                <GradientStop Color="#7FFFFFFF" Offset="0"/>
163                                <GradientStop Offset="1"/>
164                            </RadialGradientBrush>
165                        </Rectangle.Fill>
166                    </Rectangle>
167                    <StackPanel x:Name="stackPanel" Width="Auto" Orientation="Horizontal">
168                        <ContentPresenter x:Name="content" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}" 
169                                          SnapsToDevicePixels="True">
170                        </ContentPresenter>
171                    </StackPanel>
172                </Grid>
173            </Border>
174        </Border>
175        <ControlTemplate.Triggers>
176            <Trigger Property="IsPressed" Value="True">
177                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonPressedOuterBorderBrush}"/>
178                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonPressedOuterBackgroundBrush}"/>
179                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBackgroundBrush}"/>
180                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBorderBrush}"/>
181            </Trigger>
182            <Trigger Property="IsEnabled" Value="False">
183                <Setter Property="Opacity" TargetName="content" Value="0.5"/>
184                <Setter Property="Effect" TargetName="content">
185                    <Setter.Value>
186                        <Fluent:GrayscaleEffect/>
187                    </Setter.Value>
188                </Setter>
189            </Trigger>
190            <MultiTrigger>
191                <MultiTrigger.Conditions>
192                    <Condition Property="IsMouseOver" Value="True"/>
193                    <Condition Property="IsPressed" Value="False"/>
194                    <Condition Property="IsEnabled" Value="True"/>
195                </MultiTrigger.Conditions>
196                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
197                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
198                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
199                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
200                <Setter Property="Visibility" TargetName="rectangle" Value="Visible"/>
201            </MultiTrigger>
202            <MultiTrigger>
203                <MultiTrigger.Conditions>
204                    <Condition Property="IsKeyboardFocusWithin" Value="True"/>
205                    <Condition Property="IsPressed" Value="False"/>
206                </MultiTrigger.Conditions>
207                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
208                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
209                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
210                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
211            </MultiTrigger>
212        </ControlTemplate.Triggers>
213    </ControlTemplate>
214
215    <Style x:Key="CBRToggleButtonStyle" TargetType="{x:Type ToggleButton}">
216        <Setter Property="Template" Value="{StaticResource CBRToggleButtonControlTemplate}"/>
217        <Setter Property="OverridesDefaultStyle" Value="True"/>
218        <Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
219        <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
220        <Setter Property="SnapsToDevicePixels" Value="False"/>
221    </Style>
222
223    <ControlTemplate x:Key="CBRPinButtonControlTemplate" TargetType="{x:Type ToggleButton}">
224        <Border x:Name="border" BorderThickness="1" CornerRadius="2" Background="{DynamicResource TransparentBrush}" BorderBrush="{DynamicResource TransparentBrush}" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
225            <Border x:Name="border1" Height="Auto" BorderBrush="{DynamicResource TransparentBrush}" BorderThickness="1" CornerRadius="2" Background="{DynamicResource TransparentBrush}">
226                <Grid Height="Auto">
227                    <Rectangle x:Name="rectangle" StrokeThickness="0" Visibility="Collapsed">
228                        <Rectangle.Fill>
229                            <RadialGradientBrush Center="0.503,1" GradientOrigin="0.503,1" RadiusY="0.202">
230                                <GradientStop Color="#7FFFFFFF" Offset="0"/>
231                                <GradientStop Offset="1"/>
232                            </RadialGradientBrush>
233                        </Rectangle.Fill>
234                    </Rectangle>
235                    <DockPanel x:Name="stackPanel" Width="32" LastChildFill="True">
236                        <Image x:Name="imgPin" Width="16" Height="16" Source="/CBR;Component/Resources/Images/16x16/pin_no.png" />
237                    </DockPanel>
238                </Grid>
239            </Border>
240        </Border>
241        <ControlTemplate.Triggers>
242            <Trigger Property="IsChecked" Value="True">
243                <Setter Property="Source" TargetName="imgPin" Value="/CBR;Component/Resources/Images/16x16/pin_yes.png"/>
244            </Trigger>
245            <Trigger Property="IsPressed" Value="True">
246                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonPressedOuterBorderBrush}"/>
247                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonPressedOuterBackgroundBrush}"/>
248                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBackgroundBrush}"/>
249                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonPressedInnerBorderBrush}"/>
250            </Trigger>
251            <Trigger Property="IsEnabled" Value="False">
252                <Setter Property="Opacity" TargetName="imgPin" Value="0.5"/>
253                <Setter Property="Effect" TargetName="imgPin">
254                    <Setter.Value>
255                        <Fluent:GrayscaleEffect/>
256                    </Setter.Value>
257                </Setter>
258            </Trigger>
259            <MultiTrigger>
260                <MultiTrigger.Conditions>
261                    <Condition Property="IsMouseOver" Value="True"/>
262                    <Condition Property="IsPressed" Value="False"/>
263                    <Condition Property="IsEnabled" Value="True"/>
264                </MultiTrigger.Conditions>
265                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
266                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
267                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
268                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
269                <Setter Property="Visibility" TargetName="rectangle" Value="Visible"/>
270            </MultiTrigger>
271            <MultiTrigger>
272                <MultiTrigger.Conditions>
273                    <Condition Property="IsKeyboardFocusWithin" Value="True"/>
274                    <Condition Property="IsPressed" Value="False"/>
275                </MultiTrigger.Conditions>
276                <Setter Property="BorderBrush" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBorderBrush}"/>
277                <Setter Property="Background" TargetName="border1" Value="{DynamicResource ButtonHoverInnerBackgroundBrush}"/>
278                <Setter Property="Background" TargetName="border" Value="{DynamicResource ButtonHoverOuterBackgroundBrush}"/>
279                <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource ButtonHoverOuterBorderBrush}"/>
280            </MultiTrigger>
281        </ControlTemplate.Triggers>
282    </ControlTemplate>
283
284    <Style x:Key="CBRPinButtonStyle" TargetType="{x:Type ToggleButton}">
285        <Setter Property="Template" Value="{StaticResource CBRPinButtonControlTemplate}"/>
286        <Setter Property="OverridesDefaultStyle" Value="True"/>
287        <Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
288        <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
289        <Setter Property="SnapsToDevicePixels" Value="False"/>
290    </Style>
291
292</ResourceDictionary>