Files
ShrlAlgoToolkit/WPFluent/Controls/Snackbar/Snackbar.xaml

303 lines
16 KiB
XML

<!--
This Source Code Form is subject to the terms of the MIT License.
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
All Rights Reserved.
-->
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFluent.Controls">
<Style TargetType="{x:Type controls:Snackbar}">
<Setter Property="Foreground" Value="{DynamicResource SnackBarForeground}" />
<Setter Property="ContentForeground" Value="{DynamicResource SnackBarForeground}" />
<Setter Property="Background" Value="{DynamicResource SnackBarBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource SnackBarBorderBrush}" />
<Setter Property="Margin" Value="24" />
<Setter Property="MinHeight" Value="68" />
<Setter Property="Focusable" Value="False" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:Snackbar}">
<Grid
x:Name="CardBorderContainer"
Margin="0,0,0,-200"
Opacity="0">
<Border
x:Name="CardBorder"
MinHeight="{TemplateBinding MinHeight}"
Padding="12"
VerticalAlignment="Bottom"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
CornerRadius="4"
RenderTransform="{TemplateBinding SlideTransform}"
Visibility="{TemplateBinding Visibility}">
<Border.Effect>
<DropShadowEffect
BlurRadius="30"
Direction="0"
Opacity="0.4"
ShadowDepth="0"
Color="#202020" />
</Border.Effect>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition x:Name="ChevronColumn" Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter
x:Name="CardIcon"
Grid.Column="0"
Margin="0,0,12,0"
VerticalAlignment="Center"
Content="{TemplateBinding Icon}"
TextElement.FontSize="28"
TextElement.Foreground="{TemplateBinding Foreground}" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ContentPresenter
x:Name="TitleContentPresenter"
Grid.Row="0"
Margin="0"
Content="{TemplateBinding Title}"
ContentTemplate="{TemplateBinding TitleTemplate}"
TextElement.FontSize="14"
TextElement.FontWeight="SemiBold"
TextElement.Foreground="{TemplateBinding Foreground}">
<ContentPresenter.Resources>
<Style BasedOn="{StaticResource {x:Type TextBlock}}" TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="WrapWithOverflow" />
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
<ContentPresenter
Grid.Row="1"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
TextElement.FontSize="12"
TextElement.FontWeight="Regular"
TextElement.Foreground="{TemplateBinding ContentForeground}">
<ContentPresenter.Resources>
<Style BasedOn="{StaticResource {x:Type TextBlock}}" TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="WrapWithOverflow" />
</Style>
</ContentPresenter.Resources>
</ContentPresenter>
</Grid>
<controls:Button
x:Name="CloseButton"
Grid.Column="2"
Margin="12,0,0,0"
Padding="6"
Appearance="{TemplateBinding Appearance}"
Command="{Binding Path=TemplateButtonCommand, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
Foreground="{TemplateBinding Foreground}">
<controls:Button.Icon>
<controls:SymbolIcon Symbol="Dismiss48" />
</controls:Button.Icon>
</controls:Button>
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Icon" Value="{x:Null}">
<Setter TargetName="CardIcon" Property="Margin" Value="0" />
</Trigger>
<Trigger Property="IsCloseButtonEnabled" Value="False">
<Setter TargetName="CloseButton" Property="Visibility" Value="Collapsed" />
<Setter TargetName="CloseButton" Property="Margin" Value="0" />
</Trigger>
<Trigger Property="IsShown" Value="True">
<Setter Property="Focusable" Value="True" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="True" />
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="CardBorderContainer"
Storyboard.TargetProperty="Margin">
<SplineThicknessKeyFrame KeyTime="00:00:00" Value="0,0,0,-200" />
<SplineThicknessKeyFrame KeyTime="00:00:.26" Value="0,0,0,0" />
</ThicknessAnimationUsingKeyFrames>
<DoubleAnimation
Storyboard.TargetName="CardBorderContainer"
Storyboard.TargetProperty="(Grid.Opacity)"
From="0"
To="1"
Duration="0:0:.26" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ThicknessAnimationUsingKeyFrames
BeginTime="00:00:00"
Storyboard.TargetName="CardBorderContainer"
Storyboard.TargetProperty="Margin">
<SplineThicknessKeyFrame KeyTime="00:00:00" Value="0,0,0,0" />
<SplineThicknessKeyFrame KeyTime="00:00:.32" Value="0,0,0,-200" />
</ThicknessAnimationUsingKeyFrames>
<DoubleAnimation
Storyboard.TargetName="CardBorderContainer"
Storyboard.TargetProperty="(Grid.Opacity)"
From="1"
To="0"
Duration="0:0:.32" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Appearance" Value="Transparent">
<Setter Property="Background" Value="Transparent" />
</Trigger>
<Trigger Property="Appearance" Value="Primary">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource TextOnAccentFillColorPrimary}" />
</Setter.Value>
</Setter>
<Setter Property="ContentForeground">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource TextOnAccentFillColorSecondary}" />
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource SystemAccentColorSecondary}" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="Appearance" Value="Dark">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="#FFFFFF" />
</Setter.Value>
</Setter>
<Setter Property="ContentForeground">
<Setter.Value>
<SolidColorBrush Color="#87FFFFFF" />
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="#2e2e2e" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="Appearance" Value="Light">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="#E4000000" />
</Setter.Value>
</Setter>
<Setter Property="ContentForeground">
<Setter.Value>
<SolidColorBrush Color="#9E000000" />
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="#F3F3F3" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="Appearance" Value="Info">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="#FFFFFF" />
</Setter.Value>
</Setter>
<Setter Property="ContentForeground">
<Setter.Value>
<SolidColorBrush Color="#87FFFFFF" />
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource PaletteLightBlueColor}" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="Appearance" Value="Danger">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="#FFFFFF" />
</Setter.Value>
</Setter>
<Setter Property="ContentForeground">
<Setter.Value>
<SolidColorBrush Color="#87FFFFFF" />
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource PaletteRedColor}" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="Appearance" Value="Success">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="#FFFFFF" />
</Setter.Value>
</Setter>
<Setter Property="ContentForeground">
<Setter.Value>
<SolidColorBrush Color="#87FFFFFF" />
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource PaletteGreenColor}" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="Appearance" Value="Caution">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="#FFFFFF" />
</Setter.Value>
</Setter>
<Setter Property="ContentForeground">
<Setter.Value>
<SolidColorBrush Color="#87FFFFFF" />
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource PaletteOrangeColor}" />
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>