WIn_RustTools/RustTools/Views/HomePage.xaml

115 lines
4.7 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<Page
x:Class="RustTools.Views.HomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:data="using:RustTools.DataList"
xmlns:local="using:RustTools.Views"
xmlns:local1="using:Windows.ApplicationModel.Contacts"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
SizeChanged="Page_SizeChanged"
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="HomePageListItem" x:DataType="local:HomePage">
<StackPanel Orientation="Horizontal">
<Border
Width="56"
Height="56"
BorderBrush="White"
BorderThickness="0"
CornerRadius="9">
<Border.Background>
<ImageBrush ImageSource="{Binding Icon}" Stretch="UniformToFill" />
</Border.Background>
</Border>
<StackPanel Margin="10,10,10,10" Orientation="Vertical">
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="{Binding Name}" />
<TextBlock
Width="500"
MaxLines="2"
Style="{StaticResource BodyStrongTextBlockStyle}"
Text="{Binding Description}"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap" />
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{Binding UpdateTime}" />
<TextBlock
Margin="10,0,0,0"
Style="{StaticResource BodyTextBlockStyle}"
Text="{Binding CoinNumber}" />
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="次下载" />
</StackPanel>
</StackPanel>
</StackPanel>
</DataTemplate>
</Page.Resources>
<ScrollView HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<StackPanel Orientation="Vertical">
<FlipView
x:Name="Banner"
Height="360"
ItemsSource="{x:Bind Pictures}">
<FlipView.ItemTemplate>
<DataTemplate x:DataType="data:HomeBanner">
<Image
HorizontalAlignment="Center"
VerticalAlignment="Center"
PointerPressed="Image_PointerPressed"
Source="{Binding picture}"
Stretch="UniformToFill" />
</DataTemplate>
</FlipView.ItemTemplate>
</FlipView>
<PipsPager
x:Name="FlipViewPipsPager"
Margin="0,12,0,0"
HorizontalAlignment="Center"
NumberOfPages="{x:Bind Pictures.Count}"
SelectedPageIndex="{x:Bind Path=Banner.SelectedIndex, Mode=TwoWay}" />
<RelativePanel>
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="随机推荐" />
<AppBarButton
Click="RefreshRandom"
Icon="Refresh"
Label="刷新"
RelativePanel.AlignRightWithPanel="True" />
</RelativePanel>
<ListView
x:Name="list"
HorizontalAlignment="Stretch"
IsItemClickEnabled="True"
ItemClick="ListAClick"
ItemTemplate="{StaticResource HomePageListItem}"
ItemsSource="{x:Bind ViewModel.randomList}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectionMode="None" />
<RelativePanel>
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="最新发布" />
<AppBarButton
Click="RefreshLatest"
Icon="Refresh"
Label="刷新"
RelativePanel.AlignRightWithPanel="True" />
</RelativePanel>
<ListView
Grid.Row="2"
Margin="0,0,0,50"
IsItemClickEnabled="True"
ItemClick="ListAClick"
ItemTemplate="{StaticResource HomePageListItem}"
ItemsSource="{x:Bind ViewModel.latestTimeList}"
SelectionMode="None" />
</StackPanel>
</ScrollView>
</Page>