Files
Shrlalgo.RvKits/AntdWpfDemo/Views/AlertView.xaml
2025-07-31 20:12:24 +08:00

241 lines
15 KiB
XML

<UserControl
d:DesignHeight="600"
d:DesignWidth="930"
mc:Ignorable="d"
x:Class="AntDesignWPFDemo.Views.AlertView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ScrollViewer>
<Grid Margin="16,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel>
<Label Content="Alert" Style="{StaticResource Ant.H1}" />
<TextBlock Style="{StaticResource Ant.P}" Text="Alert component for feedback." />
<Label Content="When To Use" Style="{StaticResource Ant.H2}" />
<TextBlock Style="{StaticResource Ant.P}" Text="When you need to show alert messages to users.&#x0a;When you need a persistent static container which is closable by user actions." />
<Label Content="Examples" Style="{StaticResource Ant.H2}" />
</StackPanel>
<Grid Grid.Row="1">
<Grid.Resources>
<Style TargetType="antd:Alert">
<Setter Property="Margin" Value="0,0,0,15" />
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Margin="8,0">
<antd:CodeBox Title="Basic">
<antd:CodeBox.Description>
The simplest usage for short messages.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<antd:Alert Message="Success Text" Type="Success" />
</antd:CodeBox.Content>
<antd:CodeBox.Code>
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
&lt;antd:Alert Type="Success" Message="Success Text" /&gt;
</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="Closable">
<antd:CodeBox.Description>
To show close button.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<StackPanel>
<antd:Alert
Closable="True"
Type="Warning"
VerticalContentAlignment="Top">
Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text
</antd:Alert>
<antd:Alert
Closable="True"
Message="Error Text"
Type="Error">
<antd:Alert.Description>
Error Description Error Description Error Description Error Description Error Description Error Description
</antd:Alert.Description>
</antd:Alert>
</StackPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
&lt;StackPanel&gt;\n
\t&lt;antd:Alert Type="Warning" Closable="True" VerticalContentAlignment="Top"&gt;\n
\t\tWarning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text\n
\t&lt;/antd:Alert&gt;\n
\t&lt;antd:Alert Type="Error" Message="Error Text" Closable="True"&gt;\n
\t\t&lt;antd:Alert.Description&gt;\n
\t\tError Description Error Description Error Description Error Description Error Description Error Description\n
\t\t&lt;/antd:Alert.Description&gt;\n
\t&lt;/antd:Alert&gt;\n
&lt;/StackPanel&gt;
</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="Icon">
<antd:CodeBox.Description>
Decent icon make information more clear and more friendly.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<StackPanel>
<antd:Alert
Message="Success Tips"
ShowIcon="True"
Type="Success" />
<antd:Alert Message="Informational Notes" ShowIcon="True" />
<antd:Alert
Message="Warning"
ShowIcon="True"
Type="Warning" />
<antd:Alert
Message="Error"
ShowIcon="True"
Type="Error" />
<antd:Alert
Description="Detailed description and advices about successful copywriting."
Message="Success Tips"
ShowIcon="True"
Type="Success" />
<antd:Alert
Description="Additional description and informations about copywriting."
Message="Informational Notes"
ShowIcon="True" />
<antd:Alert
Description="This is a warning notice about copywriting."
Message="Warning"
ShowIcon="True"
Type="Warning" />
<antd:Alert
Description="This is an error message about copywriting."
Message="Error"
ShowIcon="True"
Type="Error" />
</StackPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
&lt;StackPanel&gt;\n
\t&lt;antd:Alert Type="Success" Message="Success Tips" ShowIcon="True" /&gt;\n
\t&lt;antd:Alert Message="Informational Notes" ShowIcon="True" /&gt;\n
\t&lt;antd:Alert Type="Warning" Message="Warning" ShowIcon="True" /&gt;\n
\t&lt;antd:Alert Type="Error" Message="Error" ShowIcon="True" /&gt;\n
\t&lt;antd:Alert Type="Success" Message="Success Tips" Description="Detailed description and advices about successful copywriting." ShowIcon="True" /&gt;\n
\t&lt;antd:Alert Message="Informational Notes" Description="Additional description and informations about copywriting." ShowIcon="True" /&gt;\n
\t&lt;antd:Alert Type="Warning" Message="Warning" Description="This is a warning notice about copywriting." ShowIcon="True" /&gt;\n
\t&lt;antd:Alert Type="Error" Message="Error" Description="This is an error message about copywriting." ShowIcon="True" /&gt;\n
&lt;/StackPanel&gt;
</antd:CodeBox.Code>
</antd:CodeBox>
</StackPanel>
<StackPanel Grid.Column="1" Margin="8,0">
<antd:CodeBox Title="More types">
<antd:CodeBox.Description>
There are 4 types of Alert: `Success`, `Info`, `Warning`, `Error`.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<StackPanel>
<antd:Alert Message="Success Text" Type="Success" />
<antd:Alert Message="Info Text" />
<antd:Alert Message="Warning Text" Type="Warning" />
<antd:Alert Message="Error Text" Type="Error" />
</StackPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
&lt;StackPanel&gt;\n
\t&lt;antd:Alert Type="Success" Message="Success Text" /&gt;\n
\t&lt;antd:Alert Message="Info Text" /&gt;\n
\t&lt;antd:Alert Type="Warning" Message="Warning Text" /&gt;\n
\t&lt;antd:Alert Type="Error" Message="Error Text" /&gt;\n
&lt;/StackPanel&gt;
</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="Description">
<antd:CodeBox.Description>
Additional description for alert message.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<StackPanel>
<antd:Alert
Description="Success Description Success Description Success Description"
Message="Success Text"
Type="Success" />
<antd:Alert Description="Info Description Info Description Info Description Info Description" Message="Info Text" />
<antd:Alert
Description="Warning Description Warning Description Warning Description Warning Description"
Message="Warning Text"
Type="Warning" />
<antd:Alert
Description="Error Description Error Description Error Description Error Description"
Message="Error Text"
Type="Error" />
</StackPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
&lt;StackPanel&gt;\n
\t&lt;antd:Alert Type="Success" Message="Success Text" Margin="0 0 0 16" /&gt;\n
\t&lt;antd:Alert Message="Info Text" Margin="0 0 0 16" /&gt;\n
\t&lt;antd:Alert Type="Warning" Message="Warning Text" Margin="0 0 0 16" /&gt;\n
\t&lt;antd:Alert Type="Error" Message="Error Text" /&gt;\n
&lt;/StackPanel&gt;
</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="Customized Close Text">
<antd:CodeBox.Description>
Replace the default icon with customized text.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<StackPanel>
<antd:Alert CloseText="Close Now" Message="Info Text" />
</StackPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
&lt;StackPanel&gt;\n
\t&lt;antd:Alert Message="Info Text" CloseText="Close Now" /&gt;\n
&lt;/StackPanel&gt;
</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="Smoothly Unmount">
<antd:CodeBox.Description>
Smoothly and unaffectedly unmount Alert.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<StackPanel>
<antd:Alert Closable="True" Message="Alert Message Text" />
<TextBlock Text="placeholder text here" />
</StackPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
&lt;ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Theme.xaml" /&gt;\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntDesignWPF"\n\n
&lt;StackPanel&gt;\n
\t&lt;antd:Alert Message="Alert Message Text" Closable="True" /&gt;\n
\t&lt;TextBlock Text="placeholder text here" /&gt;\n
&lt;/StackPanel&gt;
</antd:CodeBox.Code>
</antd:CodeBox>
</StackPanel>
</Grid>
</Grid>
</ScrollViewer>
</UserControl>