基本信息
源码名称:WPF自定义的MessageBox
源码大小:0.42M
文件格式:.7z
开发语言:C#
更新时间:2013-10-02
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Vito.Csharp.Wpf.Controls"> <SolidColorBrush x:Key="TM_SubHeaderBackground" Color="#FF2D64A0" /> <SolidColorBrush x:Key="TM_MouseOverBorderBrush" Color="#FFA4BBD4" /> <SolidColorBrush x:Key="TM_SubTitleForeground" Color="#FFFBFBFB" /> <SolidColorBrush x:Key="TM_Textbackground" Color="#FFD9DFEC" /> <SolidColorBrush x:Key="TM_BackgroundBrush" Color="#ffd1e7ff" /> <SolidColorBrush x:Key="TM_ButtonNormalBorder" Color="Transparent" /> <LinearGradientBrush x:Key="TM_ButtonMouseOverBackground" EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FF0D66C4" /> <GradientStop Color="#FF328FF3" Offset="1" /> </LinearGradientBrush> <LinearGradientBrush x:Key="TM_ButtonPressBackground" EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FF0D66C4" /> <GradientStop Color="#FF0B498B" Offset="1" /> </LinearGradientBrush> <SolidColorBrush x:Key="TM_TransparentBrush" Color="Transparent" /> <RadialGradientBrush x:Key="MessageBoxBackground" GradientOrigin="0.158,0.301" Center="0.544,0.54" RadiusY="0.842" RadiusX="0.664"> <GradientStop Color="#FFC0D8F3" Offset="1" /> <GradientStop Color="#FFF0F6FD" /> </RadialGradientBrush> <Style x:Key="MessageBoxButtonStyle" TargetType="{x:Type Button}"> <Setter Property="Focusable" Value="False" /> <!--<Setter Property="Foreground" Value="{DynamicResource TM_SubTitleForeground}" />--> <Setter Property="Padding" Value="2" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="Background" Value="{DynamicResource TM_BackgroundBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource TM_TransparentBrush}" /> <Setter Property="Foreground" Value="{DynamicResource TM_SubHeaderBackground}" /> <Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True"> <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="BorderBrush" TargetName="Bd" Value="#FF3399FF" /> <Setter Property="Background" TargetName="Bd" Value="{DynamicResource TM_ButtonMouseOverBackground}" /> <Setter Property="Foreground" Value="{StaticResource TM_Textbackground}" /> </Trigger> <Trigger Property="IsKeyboardFocused" Value="True"> <Setter Property="BorderBrush" TargetName="Bd" Value="#FF3399FF" /> <Setter Property="Background" TargetName="Bd" Value="{DynamicResource TM_ButtonMouseOverBackground}" /> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="BorderBrush" TargetName="Bd" Value="#FF3399FF" /> <Setter Property="Background" TargetName="Bd" Value="{DynamicResource TM_ButtonPressBackground}" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <ControlTemplate x:Key="MessageBoxCT" TargetType="{x:Type local:MessageBoxModule}"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3" Margin="8"> <Border.Effect> <DropShadowEffect Color="#FF004289" Opacity="0.705" BlurRadius="12" ShadowDepth="1" /> </Border.Effect> <Grid x:Name="grid"> <Grid.RowDefinitions> <RowDefinition Height="auto" /> <RowDefinition Height="*" /> <RowDefinition Height="auto" /> </Grid.RowDefinitions> <TextBlock x:Name="textBlock" Text="{TemplateBinding Title}" Grid.Row="0" Margin="10,4" TextTrimming="CharacterEllipsis" Foreground="{TemplateBinding TitleForeground}" /> <Border Grid.Row="0" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,0,1"/> <TextBlock Text="{TemplateBinding Message}" Grid.Row="1" Margin="10" TextTrimming="None" Foreground="{TemplateBinding Foreground}" TextWrapping="WrapWithOverflow" FontSize="{TemplateBinding FontSize}" /> <ItemsControl Grid.Row="2" Margin="10" ItemsSource="{TemplateBinding CtrlButtonCollection}" ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0,0,5,0"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Rows="1" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> </Grid> </Border> </ControlTemplate> <Style TargetType="{x:Type local:MessageBoxModule}"> <Style.Resources> <Storyboard x:Key="sbOpShow"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="{x:Null}"> <EasingDoubleKeyFrame KeyTime="0" Value="0"/> <EasingDoubleKeyFrame KeyTime="0:0:0.15" Value="0.975"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </Style.Resources> <Style.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <BeginStoryboard Storyboard="{StaticResource sbOpShow}"/> </EventTrigger> </Style.Triggers> <Setter Property="ResizeMode" Value="NoResize" /> <Setter Property="SizeToContent" Value="WidthAndHeight" /> <Setter Property="MinWidth" Value="330" /> <Setter Property="MinHeight" Value="145" /> <Setter Property="MaxWidth" Value="600" /> <Setter Property="MaxHeight" Value="330" /> <Setter Property="WindowStyle" Value="None" /> <Setter Property="Background" Value="{DynamicResource MessageBoxBackground}" /> <Setter Property="Foreground" Value="{StaticResource TM_SubHeaderBackground}" /> <Setter Property="AllowsTransparency" Value="True" /> <Setter Property="BorderThickness" Value="2"/> <Setter Property="BorderBrush" Value="{DynamicResource TM_SubHeaderBackground}"/> <Setter Property="Opacity" Value="0"/> <Setter Property="Template" Value="{StaticResource MessageBoxCT}" /> </Style> </ResourceDictionary>