<?xml version="1.0" encoding="utf-8" ?>
<base:LayoutUserControlBase
    x:Class="BiliCopilot.UI.Controls.Moment.MomentImageGallery"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:appearance="using:Richasy.BiliKernel.Models.Appearance"
    xmlns:base="using:Richasy.WinUIKernel.Share.Base"
    xmlns:components="using:BiliCopilot.UI.Controls.Components"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="using:BiliCopilot.UI.Controls.Moment"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <ItemsRepeater x:Name="ImageRepeater" ItemsSource="{x:Bind ItemsSource, Mode=OneWay}">
            <ItemsRepeater.ItemTemplate>
                <DataTemplate x:DataType="appearance:BiliImage">
                    <Grid
                        Width="120"
                        Height="120"
                        CornerRadius="{StaticResource ControlCornerRadius}">
                        <Image
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            Source="{x:Bind Uri, Converter={StaticResource BitmapConverter}}"
                            Stretch="UniformToFill"
                            Tag="{x:Bind}"
                            Tapped="OnImageTapped" />
                    </Grid>
                </DataTemplate>
            </ItemsRepeater.ItemTemplate>
            <ItemsRepeater.Layout>
                <ColumnMajorUniformToLargestGridLayout
                    ColumnSpacing="4"
                    MaxColumns="3"
                    RowSpacing="4" />
            </ItemsRepeater.Layout>
        </ItemsRepeater>
    </Grid>
</base:LayoutUserControlBase>
