<UserControl
    x:Class="Wino.Mail.WinUI.Controls.UpdateNotesFlipViewControl"
    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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:models="using:Wino.Core.Domain.Models.Updates"
    mc:Ignorable="d">

    <Grid RowSpacing="12">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <FlipView
            x:Name="UpdateFlipView"
            ItemsSource="{x:Bind Sections, Mode=OneWay}"
            SelectionChanged="OnFlipViewSelectionChanged">
            <FlipView.ItemTemplate>
                <DataTemplate x:DataType="models:UpdateNoteSection">
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <StackPanel Padding="8" Spacing="12">
                            <TextBlock
                                HorizontalAlignment="Center"
                                Text="{x:Bind Title, Mode=OneTime}"
                                TextAlignment="Center"
                                TextWrapping="WrapWholeWords" />
                            <Image
                                Width="{x:Bind ActualImageWidth, Mode=OneTime}"
                                Height="{x:Bind ActualImageHeight, Mode=OneTime}"
                                HorizontalAlignment="Center"
                                Source="{x:Bind ImageUrl, Mode=OneTime}"
                                Stretch="Uniform" />
                            <TextBlock
                                HorizontalAlignment="Stretch"
                                Text="{x:Bind Description, Mode=OneTime}"
                                TextWrapping="WrapWholeWords" />
                        </StackPanel>
                    </ScrollViewer>
                </DataTemplate>
            </FlipView.ItemTemplate>
        </FlipView>

        <PipsPager
            x:Name="FlipViewPager"
            Grid.Row="1"
            HorizontalAlignment="Center"
            SelectedIndexChanged="OnPipsPagerSelectedIndexChanged"
            SelectedPageIndex="0" />
    </Grid>
</UserControl>
