<UserControl
    x:Class="Bili.App.Controls.Dynamic.DynamicImageItem"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:apperance="using:Bili.Models.Data.Appearance"
    xmlns:controls="using:Microsoft.UI.Xaml.Controls"
    xmlns:controls1="using:Bili.App.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="using:Bili.App.Controls.Dynamic"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d:DesignHeight="300"
    d:DesignWidth="400"
    Loaded="OnLoaded"
    SizeChanged="OnSizeChanged"
    mc:Ignorable="d">

    <controls:ItemsRepeater x:Name="ImageRepeater" ItemsSource="{x:Bind ItemsSource, Mode=OneWay}">
        <controls:ItemsRepeater.ItemTemplate>
            <DataTemplate x:DataType="apperance:Image">
                <controls1:CommonImageEx
                    HorizontalAlignment="Stretch"
                    CornerRadius="2"
                    DataContext="{x:Bind}"
                    ImageUrl="{x:Bind Uri}"
                    Stretch="UniformToFill"
                    Tapped="OnImageTapped" />
            </DataTemplate>
        </controls:ItemsRepeater.ItemTemplate>
        <controls:ItemsRepeater.Layout>
            <controls:UniformGridLayout
                ItemsStretch="Fill"
                MinColumnSpacing="4"
                MinItemHeight="100"
                MinItemWidth="100"
                MinRowSpacing="4" />
        </controls:ItemsRepeater.Layout>
    </controls:ItemsRepeater>
</UserControl>
