|
3 | 3 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
4 | 4 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
5 | 5 | xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)"
|
6 |
| - xmlns:contract7NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,7)"> |
| 6 | + xmlns:contract7NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,7)" |
| 7 | + xmlns:not_win="http://uno.ui/not_win" |
| 8 | + xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 9 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 10 | + mc:ignorable="not_win"> |
7 | 11 | <ResourceDictionary.ThemeDictionaries>
|
8 | 12 | <ResourceDictionary x:Key="Default">
|
9 | 13 | <Thickness x:Key="ToggleButtonBorderThemeThickness">1</Thickness>
|
|
190 | 194 | <Setter Property="Background" Value="{ThemeResource ToggleButtonBackground}" />
|
191 | 195 | <contract7Present:Setter Property="BackgroundSizing" Value="InnerBorderEdge" />
|
192 | 196 | <Setter Property="Foreground" Value="{ThemeResource ToggleButtonForeground}" />
|
193 |
| - <Setter Property="BorderBrush" Value="{ThemeResource ToggleButtonBorderBrush}" /> |
| 197 | + |
| 198 | + <!-- Uno specific (LinearGradientBrush borders): Use solid border brush --> |
| 199 | + <win:Setter Property="BorderBrush" Value="{ThemeResource ToggleButtonBorderBrush}" /> |
| 200 | + <not_win:Setter Property="BorderBrush" Value="{ThemeResource ControlStrokeColorDefaultBrush}" /> |
| 201 | + |
194 | 202 | <Setter Property="BorderThickness" Value="{ThemeResource ToggleButtonBorderThemeThickness}" />
|
195 | 203 | <Setter Property="Padding" Value="{StaticResource ButtonPadding}" />
|
196 | 204 | <Setter Property="HorizontalAlignment" Value="Left" />
|
|
204 | 212 | <Setter Property="Template">
|
205 | 213 | <Setter.Value>
|
206 | 214 | <ControlTemplate TargetType="ToggleButton">
|
207 |
| - <!-- Uno workaround: template-bind ContentTemplateSelector because it's not automatically propagated from the ContentControl --> |
208 |
| - <ContentPresenter |
209 |
| - x:Name="ContentPresenter" |
210 |
| - Background="{TemplateBinding Background}" |
211 |
| - contract7Present:BackgroundSizing="{TemplateBinding BackgroundSizing}" |
212 |
| - BorderBrush="{TemplateBinding BorderBrush}" |
213 |
| - BorderThickness="{TemplateBinding BorderThickness}" |
214 |
| - Content="{TemplateBinding Content}" |
215 |
| - ContentTemplate="{TemplateBinding ContentTemplate}" |
216 |
| - ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" |
217 |
| - ContentTransitions="{TemplateBinding ContentTransitions}" |
218 |
| - contract7Present:CornerRadius="{TemplateBinding CornerRadius}" |
219 |
| - contract7NotPresent:CornerRadius="{ThemeResource ControlCornerRadius}" |
220 |
| - Padding="{TemplateBinding Padding}" |
221 |
| - HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
222 |
| - VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
223 |
| - AutomationProperties.AccessibilityView="Raw"> |
| 215 | + <!-- Uno specific (LinearGradientBrush borders): Additional Grid as template root needed --> |
| 216 | + <Grid> |
| 217 | + <!-- Uno workaround: template-bind ContentTemplateSelector because it's not automatically propagated from the ContentControl --> |
| 218 | + <ContentPresenter |
| 219 | + x:Name="ContentPresenter" |
| 220 | + Background="{TemplateBinding Background}" |
| 221 | + contract7Present:BackgroundSizing="{TemplateBinding BackgroundSizing}" |
| 222 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 223 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 224 | + Content="{TemplateBinding Content}" |
| 225 | + ContentTemplate="{TemplateBinding ContentTemplate}" |
| 226 | + ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" |
| 227 | + ContentTransitions="{TemplateBinding ContentTransitions}" |
| 228 | + contract7Present:CornerRadius="{TemplateBinding CornerRadius}" |
| 229 | + contract7NotPresent:CornerRadius="{ThemeResource ControlCornerRadius}" |
| 230 | + Padding="{TemplateBinding Padding}" |
| 231 | + HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 232 | + VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
| 233 | + AutomationProperties.AccessibilityView="Raw"> |
| 234 | + |
| 235 | + <contract7Present:ContentPresenter.BackgroundTransition> |
| 236 | + <contract7Present:BrushTransition Duration="0:0:0.083" /> |
| 237 | + </contract7Present:ContentPresenter.BackgroundTransition> |
| 238 | + |
| 239 | + </ContentPresenter> |
| 240 | + |
| 241 | + <!-- Uno specific (LinearGradientBrush borders): Simulates bottom border --> |
| 242 | + <not_win:Border x:Name="BottomBorderElement" |
| 243 | + BorderThickness="0,0,0,1" |
| 244 | + contract7Present:CornerRadius="{TemplateBinding CornerRadius}" |
| 245 | + contract7NotPresent:CornerRadius="{ThemeResource ControlCornerRadius}" |
| 246 | + BorderBrush="{ThemeResource UnoElevationBorderOverlayBrush}" /> |
224 | 247 |
|
225 |
| - <contract7Present:ContentPresenter.BackgroundTransition> |
226 |
| - <contract7Present:BrushTransition Duration="0:0:0.083" /> |
227 |
| - </contract7Present:ContentPresenter.BackgroundTransition> |
228 |
| - |
229 | 248 | <VisualStateManager.VisualStateGroups>
|
230 | 249 | <VisualStateGroup x:Name="CommonStates">
|
231 | 250 | <VisualState x:Name="Normal"/>
|
|
235 | 254 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Background">
|
236 | 255 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundPointerOver}" />
|
237 | 256 | </ObjectAnimationUsingKeyFrames>
|
238 |
| - <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush"> |
| 257 | + <!-- Uno specific (LinearGradientBrush borders): Keep the same brush --> |
| 258 | + <win:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush"> |
239 | 259 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushPointerOver}" />
|
240 |
| - </ObjectAnimationUsingKeyFrames> |
| 260 | + </win:ObjectAnimationUsingKeyFrames> |
241 | 261 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
242 | 262 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundPointerOver}" />
|
243 | 263 | </ObjectAnimationUsingKeyFrames>
|
|
251 | 271 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
252 | 272 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushPressed}" />
|
253 | 273 | </ObjectAnimationUsingKeyFrames>
|
| 274 | + <!-- Uno specific (LinearGradientBrush borders): Hide bottom border overlay --> |
| 275 | + <not_win:ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomBorderElement" Storyboard.TargetProperty="Visibility"> |
| 276 | + <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> |
| 277 | + </not_win:ObjectAnimationUsingKeyFrames> |
254 | 278 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
255 | 279 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundPressed}" />
|
256 | 280 | </ObjectAnimationUsingKeyFrames>
|
|
264 | 288 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
265 | 289 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundDisabled}" />
|
266 | 290 | </ObjectAnimationUsingKeyFrames>
|
| 291 | + <!-- Uno specific (LinearGradientBrush borders): Hide bottom border overlay --> |
| 292 | + <not_win:ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomBorderElement" Storyboard.TargetProperty="Visibility"> |
| 293 | + <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> |
| 294 | + </not_win:ObjectAnimationUsingKeyFrames> |
267 | 295 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
268 | 296 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushDisabled}" />
|
269 | 297 | </ObjectAnimationUsingKeyFrames>
|
|
278 | 306 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundChecked}" />
|
279 | 307 | </ObjectAnimationUsingKeyFrames>
|
280 | 308 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
281 |
| - <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushChecked}" /> |
| 309 | + <!-- Uno specific (LinearGradientBrush borders): Use solid color brush--> |
| 310 | + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ControlStrokeColorOnAccentDefaultBrush}" /> |
282 | 311 | </ObjectAnimationUsingKeyFrames>
|
| 312 | + <!-- Uno specific (LinearGradientBrush borders): Adjust color for accent overlay --> |
| 313 | + <not_win:ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomBorderElement" Storyboard.TargetProperty="BorderBrush"> |
| 314 | + <DiscreteObjectKeyFrame KeyTime="0" Value="ControlStrokeColorOnAccentSecondaryBrush" /> |
| 315 | + </not_win:ObjectAnimationUsingKeyFrames> |
283 | 316 | <contract7Present:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BackgroundSizing">
|
284 | 317 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonCheckedStateBackgroundSizing}" />
|
285 | 318 | </contract7Present:ObjectAnimationUsingKeyFrames>
|
|
291 | 324 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundCheckedPointerOver}" />
|
292 | 325 | </ObjectAnimationUsingKeyFrames>
|
293 | 326 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
294 |
| - <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushCheckedPointerOver}" /> |
| 327 | + <!-- Uno specific (LinearGradientBrush borders): Use solid color brush--> |
| 328 | + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ControlStrokeColorOnAccentDefaultBrush}" /> |
295 | 329 | </ObjectAnimationUsingKeyFrames>
|
| 330 | + <!-- Uno specific (LinearGradientBrush borders): Adjust color for accent overlay --> |
| 331 | + <not_win:ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomBorderElement" Storyboard.TargetProperty="BorderBrush"> |
| 332 | + <DiscreteObjectKeyFrame KeyTime="0" Value="ControlStrokeColorOnAccentSecondaryBrush" /> |
| 333 | + </not_win:ObjectAnimationUsingKeyFrames> |
296 | 334 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
297 | 335 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundCheckedPointerOver}" />
|
298 | 336 | </ObjectAnimationUsingKeyFrames>
|
|
315 | 353 | <contract7Present:ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BackgroundSizing">
|
316 | 354 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonCheckedStateBackgroundSizing}" />
|
317 | 355 | </contract7Present:ObjectAnimationUsingKeyFrames>
|
| 356 | + <!-- Uno specific (LinearGradientBrush borders): Hide bottom border overlay --> |
| 357 | + <not_win:ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomBorderElement" Storyboard.TargetProperty="Visibility"> |
| 358 | + <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> |
| 359 | + </not_win:ObjectAnimationUsingKeyFrames> |
318 | 360 | </Storyboard>
|
319 | 361 | </VisualState>
|
320 | 362 | <VisualState x:Name="CheckedDisabled">
|
|
328 | 370 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
329 | 371 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushCheckedDisabled}" />
|
330 | 372 | </ObjectAnimationUsingKeyFrames>
|
| 373 | + <!-- Uno specific (LinearGradientBrush borders): Hide bottom border overlay --> |
| 374 | + <not_win:ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomBorderElement" Storyboard.TargetProperty="Visibility"> |
| 375 | + <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> |
| 376 | + </not_win:ObjectAnimationUsingKeyFrames> |
331 | 377 | </Storyboard>
|
332 | 378 | </VisualState>
|
333 | 379 | <VisualState x:Name="Indeterminate">
|
|
339 | 385 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminate}" />
|
340 | 386 | </ObjectAnimationUsingKeyFrames>
|
341 | 387 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
342 |
| - <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminate}" /> |
| 388 | + <!-- Uno specific (LinearGradientBrush borders): Use solid color brush--> |
| 389 | + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ControlStrokeColorDefaultBrush}" /> |
343 | 390 | </ObjectAnimationUsingKeyFrames>
|
344 | 391 | </Storyboard>
|
345 | 392 | </VisualState>
|
|
349 | 396 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBackgroundIndeterminatePointerOver}" />
|
350 | 397 | </ObjectAnimationUsingKeyFrames>
|
351 | 398 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
352 |
| - <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminatePointerOver}" /> |
| 399 | + <!-- Uno specific (LinearGradientBrush borders): Use solid color brush--> |
| 400 | + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ControlStrokeColorDefaultBrush}" /> |
353 | 401 | </ObjectAnimationUsingKeyFrames>
|
354 | 402 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
355 | 403 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminatePointerOver}" />
|
|
367 | 415 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
|
368 | 416 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonForegroundIndeterminatePressed}" />
|
369 | 417 | </ObjectAnimationUsingKeyFrames>
|
| 418 | + <!-- Uno specific (LinearGradientBrush borders): Hide bottom border overlay --> |
| 419 | + <not_win:ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomBorderElement" Storyboard.TargetProperty="Visibility"> |
| 420 | + <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> |
| 421 | + </not_win:ObjectAnimationUsingKeyFrames> |
370 | 422 | </Storyboard>
|
371 | 423 | </VisualState>
|
372 | 424 | <VisualState x:Name="IndeterminateDisabled">
|
|
380 | 432 | <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="BorderBrush">
|
381 | 433 | <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ToggleButtonBorderBrushIndeterminateDisabled}" />
|
382 | 434 | </ObjectAnimationUsingKeyFrames>
|
| 435 | + <!-- Uno specific (LinearGradientBrush borders): Hide bottom border overlay --> |
| 436 | + <not_win:ObjectAnimationUsingKeyFrames Storyboard.TargetName="BottomBorderElement" Storyboard.TargetProperty="Visibility"> |
| 437 | + <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> |
| 438 | + </not_win:ObjectAnimationUsingKeyFrames> |
383 | 439 | </Storyboard>
|
384 | 440 | </VisualState>
|
385 | 441 | </VisualStateGroup>
|
386 | 442 | </VisualStateManager.VisualStateGroups>
|
387 |
| - </ContentPresenter> |
| 443 | + </Grid> |
388 | 444 | </ControlTemplate>
|
389 | 445 | </Setter.Value>
|
390 | 446 | </Setter>
|
|
0 commit comments