Files
ShrlAlgoToolkit/WPFluent/Controls/InfoBar/InfoBar.xaml

148 lines
8.8 KiB
Plaintext
Raw Normal View History

<!--
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">
<Thickness x:Key="InfoBarPadding">14,8,14,8</Thickness>
<Thickness x:Key="InfoBarBorderThemeThickness">1</Thickness>
<Style TargetType="{x:Type controls:InfoBar}">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource ControlFillColorDefault}" />
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="{DynamicResource InfoBarTitleForeground}" />
<Setter Property="Padding" Value="{StaticResource InfoBarPadding}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="BorderBrush" Value="{DynamicResource InfoBarBorderBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource InfoBarBorderThemeThickness}" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:InfoBar}">
<Grid x:Name="InfoBarRoot">
<Border
x:Name="ContentBorder"
Padding="16,14,16,10"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding Border.CornerRadius}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Margin="0,2,20,0" VerticalAlignment="Top">
<controls:SymbolIcon
x:Name="SymbolIcon"
VerticalAlignment="Top"
Filled="True"
FontSize="16" />
</Border>
<WrapPanel Grid.Column="1" VerticalAlignment="Top">
<TextBlock
x:Name="InfoTitle"
Margin="0,0,14,0"
ScrollViewer.CanContentScroll="False"
Text="{TemplateBinding Title}"
TextElement.FontSize="{TemplateBinding FontSize}"
TextElement.FontWeight="SemiBold"
TextWrapping="Wrap" />
<TextBlock
Margin="0"
ScrollViewer.CanContentScroll="False"
Text="{TemplateBinding Message}"
TextElement.FontSize="{TemplateBinding FontSize}"
TextWrapping="Wrap" />
</WrapPanel>
<Border
Grid.Column="2"
Margin="12,-2,0,0"
VerticalAlignment="Top">
<controls:Button
x:Name="CloseButton"
Padding="4"
Background="Transparent"
BorderThickness="0"
Command="{Binding Path=TemplateButtonCommand, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
IsEnabled="True">
<controls:Button.Icon>
<controls:SymbolIcon Symbol="Dismiss24" />
</controls:Button.Icon>
</controls:Button>
</Border>
</Grid>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger SourceName="InfoTitle" Property="Text" Value="">
<Setter TargetName="InfoTitle" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsClosable" Value="False">
<Setter TargetName="CloseButton" Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="IsOpen" Value="True">
<Setter Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsOpen" Value="False">
<Setter Property="Visibility" Value="Collapsed" />
</Trigger>
<Trigger Property="Severity" Value="Informational">
<Setter TargetName="SymbolIcon" Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource SystemAccentColorSecondary}" />
</Setter.Value>
</Setter>
<Setter TargetName="SymbolIcon" Property="Symbol" Value="Info24" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBarInformationalSeverityBackgroundBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Success">
<Setter TargetName="SymbolIcon" Property="Foreground" Value="{DynamicResource InfoBarSuccessSeverityIconBackground}" />
<Setter TargetName="SymbolIcon" Property="Symbol" Value="CheckmarkCircle24" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBarSuccessSeverityBackgroundBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Warning">
<Setter TargetName="SymbolIcon" Property="Foreground" Value="{DynamicResource InfoBarWarningSeverityIconBackground}" />
<Setter TargetName="SymbolIcon" Property="Symbol" Value="ErrorCircle24" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBarWarningSeverityBackgroundBrush}" />
</Trigger>
<Trigger Property="Severity" Value="Error">
<Setter TargetName="SymbolIcon" Property="Foreground" Value="{DynamicResource InfoBarErrorSeverityIconBackground}" />
<Setter TargetName="SymbolIcon" Property="Symbol" Value="DismissCircle24" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource InfoBarErrorSeverityBackgroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>