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.

173 lines
9.2 KiB

<Border x:Class="SparkClient.Views.BaseWindow.BaseControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Loaded="BaseControl_OnLoaded"
>
<Border.Resources>
<Style x:Key="CloseHoverImageStyle" TargetType="Image">
<!-- 默认图片 -->
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/02-3.png"/>
<Style.Triggers>
<!-- DataTrigger: 当父级Border的IsMouseOver=True时,切换图片Source -->
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Border}}" Value="True">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/01-4-1.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="InCloseHoverImageStyle" TargetType="Image">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/01-8.png"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Border}}" Value="True">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/01-8-1.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="InNextHoverImageStyle" TargetType="Image">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/Next.png"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Border}}" Value="True">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/NextHover.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="MiniszieHoverImageStyle" TargetType="Image">
<!-- 默认图片 -->
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/02-2.png"/>
<Style.Triggers>
<!-- DataTrigger: 当父级Border的IsMouseOver=True时,切换图片Source -->
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType=Border}}" Value="True">
<Setter Property="Source" Value="pack://application:,,,/Resource/Images/UIResource/01-3.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Height="80" VerticalAlignment="Top" MouseLeftButtonDown="UIElement_OnMouseLeftButtonDown">
<!-- 渐变背景 -->
<Grid.Background>
<ImageBrush ImageSource="../../Resource/Images/UIResource/03-0.jpg"></ImageBrush>
<!-- <LinearGradientBrush StartPoint="0,0" EndPoint="1,0"> -->
<!-- <GradientStop Color="#e8eaf7" Offset="0" /> -->
<!-- <GradientStop Color="#e8eaf7" Offset="0.7" /> -->
<!-- <GradientStop Color="#d5d7f0" Offset="1" /> -->
<!-- </LinearGradientBrush> -->
</Grid.Background>
<!-- 顶部布局 -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- 首位元素:图标 -->
<Image Grid.Column="0" Source="../../Resource/Images/icon_200.png"
Width="50" Height="50"
VerticalAlignment="Center" HorizontalAlignment="Center" Margin="20 0 5 0" />
<!-- 次位元素:标题 -->
<TextBlock Grid.Column="1" Text="{DynamicResource ProcName}"
VerticalAlignment="Center" FontWeight="Bold" x:Name="tbTitle"
HorizontalAlignment="Left" FontSize="24" >
<TextBlock.Foreground>
<LinearGradientBrush StartPoint="1,0" EndPoint="1,1">
<GradientStop Color="#11ceff" Offset="0" />
<GradientStop Color="#0a699f" Offset="1" />
</LinearGradientBrush>
</TextBlock.Foreground>
</TextBlock>
<!-- 末位元素:操作按钮 -->
<Grid Grid.Column="2" Width="260" HorizontalAlignment="Right">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- 最小化 -->
<Button Grid.Column="2" BorderBrush="Transparent" Background="Transparent"
Padding="0" Height="40" BorderThickness="0" FocusVisualStyle="{x:Null}">
<Border Grid.Column="2"
Width="40" Height="40"
HorizontalAlignment="Center" VerticalAlignment="Center"
Background="Transparent"
MouseLeftButtonDown="Minimize_Click">
<Image Style="{StaticResource MiniszieHoverImageStyle}" Height="40"></Image>
</Border>
</Button>
<!-- 关闭 -->
<Border Grid.Column="3"
Width="40" Height="40"
HorizontalAlignment="Center" VerticalAlignment="Center"
Background="Transparent"
Margin="20 0 "
MouseLeftButtonDown="Close_Click">
<Image Style="{StaticResource CloseHoverImageStyle}" Height="40"></Image>
</Border>
</Grid>
</Grid>
<Border KeyDown="UIElement_OnKeyDown" Grid.Row="1" Margin="10" CornerRadius="15" Background="#c5cbe3" Focusable="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 模拟顶部标题栏 -->
<Grid Grid.Row="0" Height="40" Margin="15 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- 标题内容 -->
<TextBlock Grid.Column="0" Text="{Binding WindowTitle}"
VerticalAlignment="Center" Foreground="#000"
FontWeight="Bold"
HorizontalAlignment="Left" FontSize="20" Margin="10 0 0 0"/>
<Border Grid.Column="2"
Width="40" Height="40"
Margin=" 0 0 10 0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Background="Transparent"
Padding="0"
>
<Button Background="Transparent" BorderBrush="Transparent" Padding="0" Visibility="{Binding ShowFunctionButton}" Command="{Binding NextCommand}">
<Image Style="{StaticResource InNextHoverImageStyle}" x:Name="ImageNext" Width="25" Height="45"/>
</Button>
</Border>
<Border Grid.Column="3"
Width="40" Height="40"
Margin=" 0 0 10 0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Background="Transparent"
Padding="0"
>
<Button Background="Transparent" BorderBrush="Transparent" Padding="0" Command="{Binding CloseCommand}" Visibility="{Binding ShowCloseButton}">
<Image Style="{StaticResource InCloseHoverImageStyle}" x:Name="ImageClosed" Width="25" Height="45"/>
</Button>
</Border>
</Grid>
<Border Grid.Row="1" Grid.Column="0" Padding="10" Margin="20 10" CornerRadius="15">
<ContentControl Name="ContentMain" Content="{Binding Content}" />
</Border>
</Grid>
</Border>
</Grid>
</Border>