WPF的MessageBox太醜了,自己定義了一個。
這是效果:
XAML:
<Window x:Class="AgileToDo.UMessageBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="UMessageBox" Height="130" Width="280" WindowStyle="None" Background="{x:Null}"
ResizeMode="NoResize" x:Name="main"
AllowsTransparency="True" WindowStartupLocation="CenterScreen">
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Loaded" >
<BeginStoryboard>
<Storyboard Name="sbOpShow">
<DoubleAnimation
Storyboard.TargetName="main"
Storyboard.TargetProperty="Opacity"
From="0" To="0.8" Duration="0:0:0.15"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
<Window.Resources>
</Window.Resources>
<Border Background="#F03A3A3A" Opacity="1" CornerRadius="3">
<Canvas>
<Border Canvas.Top="0" Height="25" Width="{Binding ElementName=main, Path=Width,UpdateSourceTrigger=PropertyChanged}"
BorderThickness="0,0,0,1" BorderBrush="#FFEFE2E2">
<TextBlock x:Name="lblTitle" Text="test" HorizontalAlignment="Left"