108 lines
8.4 KiB
XML
108 lines
8.4 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:hc="clr-namespace:HandyControl.Controls"
|
|
xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
|
|
xmlns:themes="clr-namespace:HandyControl.Themes">
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Window.xaml"/>
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
<Style x:Key="MessageBoxButtonStyle" BasedOn="{StaticResource ButtonDefault}" TargetType="Button">
|
|
<Setter Property="MinWidth" Value="88"/>
|
|
<Setter Property="Visibility" Value="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}"/>
|
|
<Setter Property="Margin" Value="5,0"/>
|
|
</Style>
|
|
|
|
<Style x:Key="MessageBoxPrimaryButtonStyle" BasedOn="{StaticResource ButtonPrimary}" TargetType="Button">
|
|
<Setter Property="MinWidth" Value="88"/>
|
|
<Setter Property="Visibility" Value="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}"/>
|
|
<Setter Property="Margin" Value="5,0"/>
|
|
</Style>
|
|
|
|
<Style TargetType="hc:MessageBox" BasedOn="{StaticResource WindowWin10}">
|
|
<Setter Property="MinHeight" Value="172"/>
|
|
<Setter Property="ShowInTaskbar" Value="False"/>
|
|
<Setter Property="MinWidth" Value="335"/>
|
|
<Setter Property="MaxWidth" Value="476"/>
|
|
<Setter Property="MaxHeight" Value="680"/>
|
|
<Setter Property="ResizeMode" Value="NoResize"/>
|
|
<Setter Property="SizeToContent" Value="WidthAndHeight"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="hc:MessageBox">
|
|
<Border SnapsToDevicePixels="True" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
|
|
<Grid Margin="{TemplateBinding Padding}">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition/>
|
|
</Grid.RowDefinitions>
|
|
<Grid Background="{TemplateBinding NonClientAreaBackground}" Name="PART_NonClientArea" TextElement.Foreground="{TemplateBinding NonClientAreaForeground}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel WindowChrome.IsHitTestVisibleInChrome="True" UseLayoutRounding="True" VerticalAlignment="Top" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
|
<Button Background="{TemplateBinding CloseButtonBackground}" Foreground="{TemplateBinding CloseButtonForeground}" IsTabStop="False" Name="PART_ButtonClose" Height="29" Style="{StaticResource ButtonIcon}" Width="46" hc:IconElement.Geometry="{StaticResource CloseGeometry}" BorderThickness="1,0,0,0" hc:IconElement.Width="10" hc:IconElement.Height="10"/>
|
|
</StackPanel>
|
|
<Grid Grid.Column="0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition/>
|
|
</Grid.ColumnDefinitions>
|
|
<Button Name="ButtonIcon" Visibility="{TemplateBinding Icon,Converter={StaticResource Object2VisibilityConverter}}" Command="{x:Static SystemCommands.ShowSystemMenuCommand}" Background="Transparent" Margin="10,0,0,0" WindowChrome.IsHitTestVisibleInChrome="True" Style="{StaticResource ButtonCustom}" VerticalAlignment="Center">
|
|
<interactivity:Interaction.Triggers>
|
|
<interactivity:EventTrigger EventName="MouseDoubleClick">
|
|
<interactivity:InvokeCommandAction Command="{x:Static SystemCommands.CloseWindowCommand}" />
|
|
</interactivity:EventTrigger>
|
|
</interactivity:Interaction.Triggers>
|
|
<Image IsHitTestVisible="False" Source="{TemplateBinding Icon}" VerticalAlignment="Center" Width="16" Height="16"/>
|
|
</Button>
|
|
<TextBlock Grid.Column="1" Text="{TemplateBinding Title}" Padding="10,0,0,0" VerticalAlignment="Center">
|
|
<TextBlock.Visibility>
|
|
<MultiBinding Converter="{StaticResource BooleanArr2VisibilityConverter}">
|
|
<MultiBinding.Bindings>
|
|
<Binding Path="ShowTitle" RelativeSource="{RelativeSource TemplatedParent}"/>
|
|
<Binding Path="Title" RelativeSource="{RelativeSource TemplatedParent}" Converter="{StaticResource Object2BooleanConverter}"/>
|
|
</MultiBinding.Bindings>
|
|
</MultiBinding>
|
|
</TextBlock.Visibility>
|
|
</TextBlock>
|
|
<ContentPresenter WindowChrome.IsHitTestVisibleInChrome="True" Grid.Column="2" x:Name="ContentPresenterMain" Content="{TemplateBinding NonClientAreaContent}"/>
|
|
</Grid>
|
|
</Grid>
|
|
<Grid Grid.Row="1">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
<Path Data="{TemplateBinding Image}" Fill="{TemplateBinding ImageBrush}" HorizontalAlignment="Center" Visibility="{TemplateBinding ShowImage,Converter={StaticResource Boolean2VisibilityConverter}}" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" Margin="20,32,0,0" Width="30" Height="30" Stretch="Uniform"/>
|
|
<ScrollViewer Grid.Row="0" Grid.Column="1" VerticalAlignment="Top">
|
|
<Border MinHeight="30" Margin="10,32,10,10" HorizontalAlignment="Left">
|
|
<TextBlock VerticalAlignment="Center" Text="{TemplateBinding Message}" TextWrapping="Wrap" />
|
|
</Border>
|
|
</ScrollViewer>
|
|
<StackPanel Name="PART_Panel" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" HorizontalAlignment="Center"/>
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsActive" Value="False">
|
|
<Setter Property="Opacity" Value=".8" TargetName="ContentPresenterMain"/>
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True" SourceName="PART_ButtonClose">
|
|
<Setter Property="Background" TargetName="PART_ButtonClose" Value="{Binding CloseButtonHoverBackground,RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
<Setter Property="Foreground" TargetName="PART_ButtonClose" Value="{Binding CloseButtonHoverForeground,RelativeSource={RelativeSource TemplatedParent}}"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</ResourceDictionary>
|