NotificationCardStyle.axaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <Styles xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:content="clr-namespace:SukiUI.Content"
  4. xmlns:controls="clr-namespace:SukiUI.Controls">
  5. <Design.PreviewWith>
  6. <Border Padding="0" Background="{DynamicResource SukiBackground}">
  7. <NotificationCard Content="Testing" />
  8. </Border>
  9. </Design.PreviewWith>
  10. <Style Selector="NotificationCard">
  11. <Setter Property="UseLayoutRounding" Value="True" />
  12. <Setter Property="Width" Value="400" />
  13. <Setter Property="Height" Value="110" />
  14. <Setter Property="FontSize" Value="14" />
  15. <Setter Property="Foreground" Value="{DynamicResource SukiCardBackground}" />
  16. <Setter Property="RenderTransformOrigin" Value="50%,75%" />
  17. <Setter Property="BorderThickness" Value="0" />
  18. <Setter Property="Background" Value="Yellow" />
  19. <Setter Property="CornerRadius" Value="{DynamicResource SmallCornerRadius}" />
  20. <Setter Property="Template">
  21. <ControlTemplate>
  22. <LayoutTransformControl Name="PART_LayoutTransformControl" UseRenderTransform="True">
  23. <Border Margin="15,15,15,15"
  24. Background="{DynamicResource SukiCardBackground}"
  25. BorderBrush="{DynamicResource SukiControlBorderBrush}"
  26. BorderThickness="1"
  27. BoxShadow="{DynamicResource SukiPopupShadow}"
  28. CornerRadius="10">
  29. <Border Background="{DynamicResource SukiCardBackground}"
  30. BorderBrush="{TemplateBinding BorderBrush}"
  31. BorderThickness="{TemplateBinding BorderThickness}"
  32. ClipToBounds="True"
  33. CornerRadius="10">
  34. <Panel>
  35. <DockPanel>
  36. <PathIcon Margin="11,11,5,5"
  37. VerticalAlignment="Top"
  38. Data="{x:Static content:Icons.CircleInformation}"
  39. DockPanel.Dock="Left"
  40. Foreground="{DynamicResource SukiPrimaryColor}" />
  41. <Panel x:Name="PART_HeaderBar"
  42. Height="4"
  43. Margin="0,-3,0,0"
  44. Classes="TextBold"
  45. DockPanel.Dock="Top" />
  46. <ContentControl Name="PART_Content" Content="{TemplateBinding Content}" />
  47. </DockPanel>
  48. </Panel>
  49. </Border>
  50. </Border>
  51. </LayoutTransformControl>
  52. </ControlTemplate>
  53. </Setter>
  54. </Style>
  55. <Style Selector="Panel.TextBold /template/ TextBlock">
  56. <Setter Property="FontWeight" Value="{DynamicResource DefaultDemiBold}" />
  57. </Style>
  58. <Style Selector="NotificationCard/template/ ContentControl#PART_Content">
  59. <Setter Property="MinHeight" Value="64" />
  60. </Style>
  61. <Style Selector="NotificationCard[IsClosing=true] /template/ LayoutTransformControl#PART_LayoutTransformControl">
  62. <Setter Property="RenderTransformOrigin" Value="50%,0%" />
  63. <Style.Animations>
  64. <Animation Easing="QuadraticEaseOut"
  65. FillMode="Forward"
  66. Duration="0:0:0.75">
  67. <KeyFrame Cue="0%">
  68. <Setter Property="TranslateTransform.X" Value="0" />
  69. <Setter Property="ScaleTransform.ScaleY" Value="1" />
  70. </KeyFrame>
  71. <KeyFrame Cue="70%">
  72. <Setter Property="TranslateTransform.X" Value="800" />
  73. <Setter Property="ScaleTransform.ScaleY" Value="1" />
  74. </KeyFrame>
  75. <KeyFrame Cue="100%">
  76. <Setter Property="ScaleTransform.ScaleY" Value="0" />
  77. <Setter Property="TranslateTransform.X" Value="800" />
  78. </KeyFrame>
  79. </Animation>
  80. </Style.Animations>
  81. </Style>
  82. <Style Selector="NotificationCard[IsClosing=true]">
  83. <Style.Animations>
  84. <Animation Easing="QuadraticEaseOut"
  85. FillMode="Forward"
  86. Duration="0:0:1.25">
  87. <KeyFrame Cue="100%">
  88. <Setter Property="IsClosed" Value="True" />
  89. </KeyFrame>
  90. </Animation>
  91. </Style.Animations>
  92. </Style>
  93. <Style Selector="NotificationCard /template/ Panel#PART_HeaderBar">
  94. <Setter Property="Background" Value="{DynamicResource SukiCardBackground}" />
  95. </Style>
  96. <Style Selector="NotificationCard /template/ Panel#PART_HeaderBar">
  97. <Setter Property="Background" Value="{DynamicResource SukiCardBackground}" />
  98. </Style>
  99. <Style Selector="NotificationCard:success">
  100. <Setter Property="Template">
  101. <ControlTemplate>
  102. <LayoutTransformControl Name="PART_LayoutTransformControl" UseRenderTransform="True">
  103. <Border Margin="15,15,15,15"
  104. Background="{DynamicResource SukiCardBackground}"
  105. BorderBrush="{DynamicResource SukiControlBorderBrush}"
  106. BorderThickness="1"
  107. BoxShadow="{DynamicResource SukiPopupShadow}"
  108. CornerRadius="10">
  109. <Border Background="{DynamicResource SukiCardBackground}"
  110. BorderBrush="{TemplateBinding BorderBrush}"
  111. BorderThickness="{TemplateBinding BorderThickness}"
  112. ClipToBounds="True"
  113. CornerRadius="10">
  114. <DockPanel>
  115. <PathIcon Margin="11,11,5,5"
  116. VerticalAlignment="Top"
  117. Data="{x:Static content:Icons.CircleCheck}"
  118. DockPanel.Dock="Left"
  119. Foreground="ForestGreen" />
  120. <Panel x:Name="PART_HeaderBar"
  121. Height="4"
  122. Margin="0,-3,0,0"
  123. Classes="TextBold"
  124. DockPanel.Dock="Top" />
  125. <ContentControl Name="PART_Content" Content="{TemplateBinding Content}" />
  126. </DockPanel>
  127. </Border>
  128. </Border>
  129. </LayoutTransformControl>
  130. </ControlTemplate>
  131. </Setter>
  132. </Style>
  133. <Style Selector="NotificationCard:warning">
  134. <Setter Property="Template">
  135. <ControlTemplate>
  136. <LayoutTransformControl Name="PART_LayoutTransformControl" UseRenderTransform="True">
  137. <Border Margin="15,15,15,15"
  138. Background="{DynamicResource SukiCardBackground}"
  139. BorderBrush="{DynamicResource SukiControlBorderBrush}"
  140. BorderThickness="1"
  141. BoxShadow="{DynamicResource SukiPopupShadow}"
  142. CornerRadius="10">
  143. <Border Background="{DynamicResource SukiCardBackground}"
  144. BorderBrush="{TemplateBinding BorderBrush}"
  145. BorderThickness="{TemplateBinding BorderThickness}"
  146. ClipToBounds="True"
  147. CornerRadius="10">
  148. <DockPanel>
  149. <PathIcon Margin="11,11,5,5"
  150. VerticalAlignment="Top"
  151. Data="{x:Static content:Icons.CircleWarning}"
  152. DockPanel.Dock="Left"
  153. Foreground="DarkOrange" />
  154. <Panel x:Name="PART_HeaderBar"
  155. Height="4"
  156. Margin="0,-3,0,0"
  157. Classes="TextBold"
  158. DockPanel.Dock="Top" />
  159. <ContentControl Name="PART_Content" Content="{TemplateBinding Content}" />
  160. </DockPanel>
  161. </Border>
  162. </Border>
  163. </LayoutTransformControl>
  164. </ControlTemplate>
  165. </Setter>
  166. </Style>
  167. <Style Selector="NotificationCard:error">
  168. <Setter Property="Template">
  169. <ControlTemplate>
  170. <LayoutTransformControl Name="PART_LayoutTransformControl" UseRenderTransform="True">
  171. <Border Margin="15,15,15,15"
  172. Background="{DynamicResource SukiCardBackground}"
  173. BorderBrush="{DynamicResource SukiControlBorderBrush}"
  174. BorderThickness="1"
  175. BoxShadow="{DynamicResource SukiPopupShadow}"
  176. CornerRadius="10">
  177. <Border Background="{DynamicResource SukiCardBackground}"
  178. BorderBrush="{TemplateBinding BorderBrush}"
  179. BorderThickness="{TemplateBinding BorderThickness}"
  180. ClipToBounds="True"
  181. CornerRadius="10">
  182. <DockPanel>
  183. <PathIcon Width="26"
  184. Height="26"
  185. Margin="11,11,5,5"
  186. VerticalAlignment="Top"
  187. Data="{x:Static content:Icons.Error}"
  188. DockPanel.Dock="Left"
  189. Foreground="DarkRed" />
  190. <Panel x:Name="PART_HeaderBar"
  191. Height="4"
  192. Margin="0,-3,0,0"
  193. Classes="TextBold"
  194. DockPanel.Dock="Top" />
  195. <ContentControl Name="PART_Content" Content="{TemplateBinding Content}" />
  196. </DockPanel>
  197. </Border>
  198. </Border>
  199. </LayoutTransformControl>
  200. </ControlTemplate>
  201. </Setter>
  202. </Style>
  203. </Styles>