No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

94 líneas
5.7 KiB

  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:bpa="clr-namespace:BPA.UIControl"
  4. xmlns:converter="clr-namespace:BPA.UIControl.Converters">
  5. <ResourceDictionary.MergedDictionaries>
  6. <ResourceDictionary>
  7. <converter:BadgeOffsetConverter x:Key="BadgeOffsetConverter" />
  8. </ResourceDictionary>
  9. <ResourceDictionary Source="pack://application:,,,/BPA.UIControl;component/Themes/Resources/Default.xaml" />
  10. </ResourceDictionary.MergedDictionaries>
  11. <Style x:Key="RubyerBadge" TargetType="{x:Type bpa:Badge}">
  12. <Setter Property="BadgeBrush" Value="{StaticResource Error}" />
  13. <Setter Property="BorderBrush" Value="Transparent" />
  14. <Setter Property="BorderThickness" Value="0" />
  15. <Setter Property="Foreground" Value="{StaticResource WhiteForeground}" />
  16. <Setter Property="IsTabStop" Value="False" />
  17. <Setter Property="SnapsToDevicePixels" Value="True" />
  18. <Setter Property="BadgeFontSize" Value="11" />
  19. <Setter Property="BadgeSize" Value="20" />
  20. <Setter Property="Template">
  21. <Setter.Value>
  22. <ControlTemplate TargetType="{x:Type bpa:Badge}">
  23. <Grid>
  24. <Border x:Name="border"
  25. MinWidth="{TemplateBinding BadgeSize}"
  26. MinHeight="{TemplateBinding BadgeSize}"
  27. HorizontalAlignment="Right"
  28. VerticalAlignment="Top"
  29. Panel.ZIndex="1"
  30. Background="{TemplateBinding BadgeBrush}"
  31. CornerRadius="{Binding ActualHeight, RelativeSource={RelativeSource Self}, Converter={StaticResource HalfOfDoubleConverter}}"
  32. RenderTransformOrigin="0.5 0.5">
  33. <Border.RenderTransform>
  34. <ScaleTransform />
  35. </Border.RenderTransform>
  36. <Border.Margin>
  37. <MultiBinding Converter="{StaticResource BadgeOffsetConverter}">
  38. <Binding ElementName="border" Path="ActualHeight" />
  39. <Binding ElementName="border" Path="ActualWidth" />
  40. </MultiBinding>
  41. </Border.Margin>
  42. <TextBlock x:Name="text"
  43. Margin="5 2"
  44. HorizontalAlignment="Center"
  45. FontSize="{TemplateBinding BadgeFontSize}"
  46. Text="{TemplateBinding Text}" />
  47. </Border>
  48. <ContentPresenter Focusable="False"
  49. RecognizesAccessKey="True"
  50. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  51. </Grid>
  52. <ControlTemplate.Triggers>
  53. <DataTrigger Binding="{Binding Text, RelativeSource={RelativeSource Self}, Converter={StaticResource IsNullOrEmptyConverter}}" Value="True">
  54. <Setter TargetName="text" Property="Visibility" Value="Collapsed" />
  55. <Setter Property="BadgeSize" Value="10" />
  56. </DataTrigger>
  57. <Trigger Property="IsHidden" Value="True">
  58. <Setter TargetName="border" Property="Visibility" Value="Collapsed" />
  59. </Trigger>
  60. <EventTrigger RoutedEvent="TextChanged">
  61. <BeginStoryboard>
  62. <BeginStoryboard.Storyboard>
  63. <Storyboard>
  64. <DoubleAnimation Storyboard.TargetName="border"
  65. Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleX)"
  66. From="0.6"
  67. To="1"
  68. Duration="0:0:0.3">
  69. <DoubleAnimation.EasingFunction>
  70. <BackEase EasingMode="EaseOut" />
  71. </DoubleAnimation.EasingFunction>
  72. </DoubleAnimation>
  73. <DoubleAnimation Storyboard.TargetName="border"
  74. Storyboard.TargetProperty="RenderTransform.(ScaleTransform.ScaleY)"
  75. From="0.6"
  76. To="1"
  77. Duration="0:0:0.3">
  78. <DoubleAnimation.EasingFunction>
  79. <BackEase EasingMode="EaseOut" />
  80. </DoubleAnimation.EasingFunction>
  81. </DoubleAnimation>
  82. </Storyboard>
  83. </BeginStoryboard.Storyboard>
  84. </BeginStoryboard>
  85. </EventTrigger>
  86. </ControlTemplate.Triggers>
  87. </ControlTemplate>
  88. </Setter.Value>
  89. </Setter>
  90. </Style>
  91. </ResourceDictionary>