detect/detect.gui/Assets/NotificationCard.axaml

84 lines
4.5 KiB
Plaintext
Raw Permalink Normal View History

2024-11-13 17:09:15 +08:00
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- NotificationCard -->
<Style Selector="NotificationCard">
<Setter Property="UseLayoutRounding" Value="False"/>
<Setter Property="Foreground" Value="{StaticResource Light}" />
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="#2D77F3" Opacity="0.6" />
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush">
<Setter.Value>
<SolidColorBrush Color="#2D77F3" Opacity="0.7" />
</Setter.Value>
</Setter>
<Setter Property="CornerRadius" Value="6" />
<Setter Property="Template">
<ControlTemplate TargetType="NotificationCard">
<LayoutTransformControl Name="PART_LayoutTransformControl"
UseRenderTransform="True">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Margin="0,0,0,2">
<StackPanel Orientation="Horizontal">
<Border Margin="20">
<PathIcon Name="NotificationIcon"
Width="36"
Height="36" />
</Border>
<ContentControl Name="PART_Content"
MinHeight="64"
Content="{TemplateBinding Content}"
Margin="0,20,20,20">
<ContentControl.DataTemplates>
<DataTemplate DataType="INotification">
<StackPanel VerticalAlignment="Center">
<TextBlock FontFamily="{StaticResource Font-Family}"
FontSize="14"
Foreground="#FFFFFF"
Text="{Binding Message}" />
</StackPanel>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</StackPanel>
</Border>
</LayoutTransformControl>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="NotificationCard:information /template/ PathIcon#NotificationIcon">
<Setter Property="Foreground" Value="{DynamicResource Info}"/>
<Setter Property="Data" Value="{DynamicResource NotificationInformationData}"/>
</Style>
<Style Selector="NotificationCard:error /template/ PathIcon#NotificationIcon">
<Setter Property="Foreground" Value="{DynamicResource Danger}"/>
<Setter Property="Data" Value="{DynamicResource NotificationErrorData}"/>
</Style>
<Style Selector="NotificationCard:success /template/ PathIcon#NotificationIcon">
<Setter Property="Foreground" Value="{DynamicResource Success}"/>
<Setter Property="Data" Value="{DynamicResource NotificationSuccessData}"/>
</Style>
<Style Selector="NotificationCard:warning /template/ PathIcon#NotificationIcon">
<Setter Property="Foreground" Value="{DynamicResource Warning}"/>
<Setter Property="Data" Value="{DynamicResource NotificationWaringData}"/>
</Style>
<!-- <Style Selector="NotificationCard:information"> -->
<!-- <Setter Property="BorderBrush" Value="{DynamicResource Info}"/> -->
<!-- </Style> -->
<!-- <Style Selector="NotificationCard:error"> -->
<!-- <Setter Property="BorderBrush" Value="{DynamicResource Danger}"/> -->
<!-- </Style> -->
<!-- <Style Selector="NotificationCard:success"> -->
<!-- <Setter Property="BorderBrush" Value="{DynamicResource Success}"/> -->
<!-- </Style> -->
<!-- <Style Selector="NotificationCard:warning"> -->
<!-- <Setter Property="BorderBrush" Value="{DynamicResource Warning}"/> -->
<!-- </Style> -->
</Styles>