WIn_RustTools/RustTools/Views/HomePage.xaml
2024-07-23 20:24:41 +08:00

101 lines
4.1 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: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 ImageUrl}" Stretch="UniformToFill" />
</Border.Background>
</Border>
<StackPanel Margin="10,10,10,10" Orientation="Vertical">
<TextBlock Style="{StaticResource SubtitleTextBlockStyle}" Text="{Binding Title}" />
<TextBlock
Width="500"
MaxLines="2"
Style="{StaticResource BodyStrongTextBlockStyle}"
Text="{Binding Message}"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap" />
<TextBlock Style="{StaticResource BodyTextBlockStyle}" Text="{Binding Info}" />
</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="x:String">
<Image
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="{x:Bind Mode=OneTime}"
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
Icon="Refresh"
Label="刷新"
RelativePanel.AlignRightWithPanel="True" />
</RelativePanel>
<ListView
x:Name="list"
HorizontalAlignment="Stretch"
IsItemClickEnabled="True"
ItemClick="ListAClick"
ItemTemplate="{StaticResource HomePageListItem}"
ItemsSource="{x:Bind conns}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectionMode="None" />
<RelativePanel>
<TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="最新发布" />
<AppBarButton
Icon="Refresh"
Label="刷新"
RelativePanel.AlignRightWithPanel="True" />
</RelativePanel>
<ListView
Grid.Row="2"
Margin="0,0,0,50"
IsItemClickEnabled="True"
ItemTemplate="{StaticResource HomePageListItem}"
ItemsSource="{x:Bind newlist}"
SelectionMode="None" />
</StackPanel>
</ScrollView>
</Page>