<?xml version="1.0" encoding="utf-8"?>
<Page
    x:Class="XFENewsApplication.Views.HotSearchViewPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:XFENewsApplication.Views"
    xmlns:coremodel="using:XFENewsApplication.Core.Models"
    xmlns:converter="using:XFEExtension.NetCore.WinUIHelper.Utilities.Converter"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Page.Resources>
        <converter:URLImageConverter x:Key="URLImageConverter"/>
    </Page.Resources>

    <Grid>
        <ListView x:Name="hotSearchListView" ItemsSource="{x:Bind ViewModel.HotSearchSource}" SelectedIndex="{x:Bind ViewModel.SelectedIndex, Mode=TwoWay}" IsDoubleTapEnabled="True">
            <ListView.ItemTemplate>
                <DataTemplate x:DataType="coremodel:NewsSource">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="30"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="{x:Bind Index}" VerticalAlignment="Center" FontSize="18"/>
                        <StackPanel Orientation="Horizontal" Grid.Column="1" Spacing="5" VerticalAlignment="Center">
                            <TextBlock Text="{x:Bind Title}" VerticalAlignment="Center" FontSize="15"/>
                            <Image Margin="0,0,5,0" Height="{x:Bind ImageHeight}" Source="{x:Bind ImageUrl, Converter={StaticResource URLImageConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            <TextBlock Text="{x:Bind Abstract}" VerticalAlignment="Center" Foreground="{ThemeResource TextFillColorDisabled}"/>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </Grid>
</Page>
