兼容win7版应用
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.

177 lines
8.7 KiB

<UserControl x:Class="AIK.Views.MenuPages.Home.HomePage"
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:local="clr-namespace:AIK.Views.MenuPages.Home"
xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:convert="clr-namespace:AIK.Views.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<!-- 全局资源 -->
<SolidColorBrush x:Key="PrimaryColor" Color="#2B579A"/>
<SolidColorBrush x:Key="LightBorderColor" Color="#E0E0E0"/>
<!-- 导航按钮样式 -->
<Style x:Key="NavButtonStyle" TargetType="Button">
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Background" Value="#80FFFFFF"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="25" Padding="5">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#CCFFFFFF"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 可复用的卡片样式 -->
<Style x:Key="CardBorderStyle" TargetType="Border">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="{StaticResource LightBorderColor}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="12"/>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="8" ShadowDepth="2" Opacity="0.15" Color="#888888"/>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<!-- Banner 区域:2/3 -->
<RowDefinition Height="20"/>
<!-- 间隔 -->
<RowDefinition Height="1*"/>
<!-- 二维码区域:1/3 -->
</Grid.RowDefinitions>
<Border Style="{StaticResource CardBorderStyle}" Grid.Row="0" Margin="8" ClipToBounds="True">
<Grid>
<!-- Banner 区域 -->
<Border CornerRadius="8" Margin="20" ClipToBounds="True" Width="1000" Height="450">
<Image Source="{Binding CurrentBitmapImage}"
Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<!-- 左箭头 -->
<Button Command="{Binding PreviousCommand}"
Visibility="{Binding IsFirst, Converter={StaticResource BoolToVisibilityConverter}}"
Style="{StaticResource NavButtonStyle}"
HorizontalAlignment="Left" Margin="30,0,0,0">
<TextBlock Text="&#xE76B;" FontFamily="Segoe MDL2 Assets" FontSize="24" Foreground="#2B579A"/>
</Button>
<!-- 右箭头 -->
<Button Command="{Binding NextCommand}"
Visibility="{Binding IsLast, Converter={StaticResource BoolToVisibilityConverter}}"
Style="{StaticResource NavButtonStyle}"
HorizontalAlignment="Right" Margin="0,0,30,0">
<TextBlock Text="&#xE76C;" FontFamily="Segoe MDL2 Assets" FontSize="24" Foreground="#2B579A"/>
</Button>
<!-- 指示器圆点 -->
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Margin="0,0,0,30">
<ItemsControl ItemsSource="{Binding Banners}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Ellipse Width="12" Height="12" Cursor="Hand">
<Ellipse.Style>
<Style TargetType="Ellipse">
<Setter Property="Fill" Value="LightGray"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsSelected}" Value="True">
<Setter Property="Fill" Value="#2B579A"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
<Ellipse.InputBindings>
<MouseBinding MouseAction="LeftClick"
Command="{Binding DataContext.SelectBannerCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
CommandParameter="{Binding Index}"/>
</Ellipse.InputBindings>
</Ellipse>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Grid>
</Border>
<Border Style="{StaticResource CardBorderStyle}" Grid.Row="2" Margin="8" Padding="20">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{DynamicResource Tip}" Grid.Column="0" Grid.Row="0"
FontSize="18"
HorizontalAlignment="Left"
FontWeight="Bold"
VerticalAlignment="Top"
Foreground="#666666"
TextWrapping="Wrap"/>
<TextBlock Text="{DynamicResource HomeTip}" Grid.Column="0" Grid.Row="0"
Grid.ColumnSpan="4"
Margin="40,10,0,0"
FontSize="14"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="#666666"
TextWrapping="Wrap"/>
<!-- 二维码图像 -->
<Image Grid.Column="0" Grid.Row="1"
Source="{Binding QrCodeBytes,Converter={StaticResource ByteArrayToImageSourceConverter}}"
Width="120" Height="120"
Stretch="UniformToFill"
HorizontalAlignment="Left"/>
<!-- 文字说明 -->
<StackPanel Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" >
<TextBlock Text="{DynamicResource ScanToDownload}"
FontSize="18"
FontWeight="Bold"
Foreground="{StaticResource PrimaryColor}"
Margin="0,0,0,8"/>
<TextBlock Text="{DynamicResource GetLatestInfo}"
FontSize="14"
Foreground="#666666"
TextWrapping="Wrap"/>
</StackPanel>
<TextBlock Text="{DynamicResource Slogan}" Grid.Column="3" Grid.Row="1"
FontSize="14"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#666666"
TextWrapping="Wrap"/>
</Grid>
</Border>
</Grid>
</UserControl>