You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
182 lines
11 KiB
182 lines
11 KiB
<!--*********************************************************************
|
|
|
|
Extended WPF Toolkit
|
|
|
|
Copyright (C) 2010-2012 Xceed Software Inc.
|
|
|
|
This program is provided to you under the terms of the Microsoft Public
|
|
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
|
|
|
This program can be provided to you by Xceed Software Inc. under a
|
|
proprietary commercial license agreement for use in non-Open Source
|
|
projects. The commercial version of Extended WPF Toolkit also includes
|
|
priority technical support, commercial updates, and many additional
|
|
useful WPF controls if you license Xceed Business Suite for WPF.
|
|
|
|
Visit http://xceed.com and follow @datagrid on Twitter.
|
|
|
|
********************************************************************-->
|
|
<sample:DemoView x:Class="Samples.Modules.MessageBox.Views.HomeView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:sample="clr-namespace:Samples.Infrastructure.Controls;assembly=Samples.Infrastructure"
|
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
|
Title="MessageBox"
|
|
Description="This extended MessageBox allows you to customize and style various aspects of the control.">
|
|
<sample:DemoView.Resources>
|
|
<LinearGradientBrush x:Key="buttonRegionBackground" StartPoint="0,0" EndPoint="1,1">
|
|
<LinearGradientBrush.GradientStops>
|
|
<GradientStopCollection>
|
|
<GradientStop Offset="0" Color="#FF3D3D3D" />
|
|
<GradientStop Offset="1" Color="#FF000000" />
|
|
</GradientStopCollection>
|
|
</LinearGradientBrush.GradientStops>
|
|
</LinearGradientBrush>
|
|
|
|
<SolidColorBrush x:Key="MyButtonHoverBrush" Color="#FFD23C93" />
|
|
<SolidColorBrush x:Key="MyButtonPressedBrush" Color="#FF841B5D" />
|
|
|
|
<LinearGradientBrush x:Key="WindowDarkBrush" EndPoint="0.5,1" StartPoint="0.5,0">
|
|
<GradientStop Color="#FFA3AEB9" Offset="0" />
|
|
<GradientStop Color="#FF8399A9" Offset="0.375" />
|
|
<GradientStop Color="#FF718597" Offset="0.375" />
|
|
<GradientStop Color="#FF617584" Offset="1" />
|
|
</LinearGradientBrush>
|
|
|
|
<LinearGradientBrush x:Key="WindowButtonHoverBrush" StartPoint="0,0" EndPoint="0,1">
|
|
<LinearGradientBrush.GradientStops>
|
|
<GradientStopCollection>
|
|
<GradientStop Offset="0" Color="#FFb5bdc8" />
|
|
<GradientStop Offset="0.370" Color="#FF8399a9" />
|
|
<GradientStop Offset="0.370" Color="#FF718597" />
|
|
<GradientStop Offset="0.906" Color="#FFb9c1ca" />
|
|
<GradientStop Offset="1" Color="#FFb9c1ca" />
|
|
</GradientStopCollection>
|
|
</LinearGradientBrush.GradientStops>
|
|
</LinearGradientBrush>
|
|
|
|
<LinearGradientBrush x:Key="WindowButtonPressedBrush" StartPoint="0,0" EndPoint="0,1">
|
|
<LinearGradientBrush.GradientStops>
|
|
<GradientStopCollection>
|
|
<GradientStop Offset="0" Color="#FF6b7c8d" />
|
|
<GradientStop Offset="0.370" Color="#FF4d606f" />
|
|
<GradientStop Offset="0.370" Color="#FF465460" />
|
|
<GradientStop Offset="0.906" Color="#FF262d33" />
|
|
<GradientStop Offset="1" Color="#FF262d33" />
|
|
</GradientStopCollection>
|
|
</LinearGradientBrush.GradientStops>
|
|
</LinearGradientBrush>
|
|
|
|
<Style x:Key="MyCloseButtonStyle" TargetType="Button">
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Grid>
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Normal"/>
|
|
<VisualState x:Name="MouseOver">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background)">
|
|
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource MyButtonHoverBrush}"></DiscreteObjectKeyFrame>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Pressed">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background)">
|
|
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource MyButtonPressedBrush}"></DiscreteObjectKeyFrame>
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Disabled">
|
|
<Storyboard>
|
|
<DoubleAnimation Duration="0" Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="Opacity" To=".3"/>
|
|
<DoubleAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To=".3"/>
|
|
</Storyboard>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
<Border x:Name="Background" CornerRadius="0,0,2,0" Background="#FF565456">
|
|
<Border Margin="1,0,1,1" BorderBrush="#59FFFFFF" BorderThickness="1" CornerRadius="0,0,1,0"/>
|
|
</Border>
|
|
<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
|
|
<Path x:Name="path" Fill="White" Margin="0,0,0,1" Visibility="Collapsed"
|
|
Height="6"
|
|
Width="7"
|
|
Stretch="Fill"
|
|
Opacity="1"
|
|
Data="M 2,6 C2,6 3,6 3,6 3,6 3,5 3,5 3,5 4,5 4,5 4,5 4,6 4,6 4,6 5,6 5,6 5,6 7,6 7,6 7,6 7,5 7,5 7,5 6,5 6,5 6,5 6,4 6,4 6,4 5,4 5,4 5,4 5,2 5,2 5,2 6,2 6,2 6,2 6,1 6,1 6,1 7,1 7,1 7,1 7,0 7,0 7,0 5,0 5,0 5,0 4,0 4,0 4,0 4,1 4,1 4,1 3,1 3,1 3,1 3,0 3,0 3,0 2,0 2,0 2,0 0,0 0,0 0,0 0,1 0,1 0,1 1,1 1,1 1,1 1,2 1,2 1,2 2,2 2,2 2,2 2,4 2,4 2,4 1,4 1,4 1,4 1,5 1,5 1,5 0,5 0,5 0,5 0,6 0,6 0,6 2,6 2,6 z"/>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="WindowButtonStyle" TargetType="Button">
|
|
<Setter Property="Foreground" Value="#FFFFFFFF" />
|
|
<Setter Property="Padding" Value="3" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Grid>
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Normal" />
|
|
<VisualState x:Name="MouseOver">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background)">
|
|
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource WindowButtonHoverBrush}" />
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
<VisualState x:Name="Pressed">
|
|
<Storyboard>
|
|
<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background)">
|
|
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource WindowButtonPressedBrush}" />
|
|
</ObjectAnimationUsingKeyFrames>
|
|
</Storyboard>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
<Border x:Name="Background" CornerRadius="0,0,2,0" Background="{StaticResource WindowDarkBrush}">
|
|
<Border Margin="1,0,1,1" BorderBrush="#59FFFFFF" BorderThickness="1" CornerRadius="0,0,1,0" />
|
|
</Border>
|
|
<ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="messageBoxStyle" TargetType="{x:Type xctk:MessageBox}">
|
|
<Setter Property="Background" Value="Black" />
|
|
<Setter Property="BorderBrush" Value="Pink" />
|
|
<Setter Property="CaptionForeground" Value="White" />
|
|
<Setter Property="WindowBorderBrush" Value="Black" />
|
|
<Setter Property="WindowBackground" Value="#FF7304A2" />
|
|
<Setter Property="WindowOpacity" Value="0.65" />
|
|
<Setter Property="Foreground" Value="White"/>
|
|
<Setter Property="ButtonRegionBackground" Value="{StaticResource buttonRegionBackground}" />
|
|
<Setter Property="OkButtonStyle" Value="{StaticResource WindowButtonStyle}" />
|
|
<Setter Property="CancelButtonStyle" Value="{StaticResource WindowButtonStyle}" />
|
|
<Setter Property="YesButtonStyle" Value="{StaticResource WindowButtonStyle}" />
|
|
<Setter Property="NoButtonStyle" Value="{StaticResource WindowButtonStyle}" />
|
|
<Setter Property="CloseButtonStyle" Value="{StaticResource MyCloseButtonStyle}"/>
|
|
</Style>
|
|
</sample:DemoView.Resources>
|
|
|
|
<StackPanel Orientation="Horizontal"
|
|
HorizontalAlignment="Center">
|
|
<Button Width="150"
|
|
Height="100"
|
|
Margin="10"
|
|
Content="Standard MessageBox"
|
|
Click="StandardMessageBoxButton_Click"/>
|
|
<Button Width="150"
|
|
Height="100"
|
|
Content="Styled MessageBox"
|
|
Click="StyledMessageBoxButton_Click"/>
|
|
</StackPanel>
|
|
</sample:DemoView>
|
|
|