<abstract:MailRenderingPageAbstract
    x:Class="Wino.Views.MailRenderingPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:abstract="using:Wino.Views.Abstract"
    xmlns:controls="using:Wino.Controls"
    xmlns:customcontrols="using:Wino.Core.UWP.Controls.CustomControls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:domain="using:Wino.Core.Domain"
    xmlns:entities="using:Wino.Core.Domain.Entities.Shared"
    xmlns:helpers="using:Wino.Helpers"
    xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
    xmlns:local="using:Wino.Behaviors"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
    xmlns:toolkit="using:CommunityToolkit.WinUI.Controls"
    xmlns:viewModelData="using:Wino.Mail.ViewModels.Data"
    x:Name="root"
    muxc:BackdropMaterial.ApplyToRootOrPageBackground="{ThemeResource UseMica}"
    IsDarkEditor="{x:Bind ViewModel.IsDarkWebviewRenderer, Mode=TwoWay}"
    mc:Ignorable="d">

    <Page.Resources>
        <DataTemplate x:Key="InternetAddressTemplate" x:DataType="entities:AccountContact">
            <HyperlinkButton
                Margin="-2,-2"
                Padding="4,2"
                Click="InternetAddressClicked"
                Content="{x:Bind ShortDisplayName}"
                ToolTipService.ToolTip="{x:Bind DisplayName}">
                <HyperlinkButton.ContextFlyout>
                    <Flyout Placement="Bottom">
                        <Grid ColumnSpacing="10">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <controls:ImagePreviewControl
                                Grid.RowSpan="2"
                                Width="36"
                                Height="36"
                                FromAddress="{x:Bind Address}"
                                FromName="{x:Bind Name}"
                                SenderContactPicture="{x:Bind Base64ContactPicture}" />

                            <TextBlock Grid.Column="1" Text="{x:Bind Name}" />

                            <HyperlinkButton
                                Grid.Row="1"
                                Grid.Column="1"
                                Padding="0"
                                Command="{Binding ElementName=root, Path=ViewModel.CopyClipboardCommand}"
                                CommandParameter="{x:Bind Address}"
                                Content="{x:Bind Address}" />
                        </Grid>
                    </Flyout>
                </HyperlinkButton.ContextFlyout>
            </HyperlinkButton>
        </DataTemplate>

        <!--  Attachment Template  -->
        <!--  Margin -8 0 is used to remove the padding from the ListViewItem  -->
        <DataTemplate x:Key="FileAttachmentTemplate" x:DataType="viewModelData:MailAttachmentViewModel">
            <Grid Height="51">
                <Grid.RowDefinitions>
                    <RowDefinition Height="50" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid
                    Grid.Row="0"
                    Height="50"
                    Margin="-8,0,0,0"
                    Background="Transparent"
                    ColumnSpacing="3">
                    <ToolTipService.ToolTip>
                        <ToolTip Content="{x:Bind FileName}" />
                    </ToolTipService.ToolTip>
                    <Grid.ContextFlyout>
                        <MenuFlyout Placement="Right">
                            <MenuFlyoutItem
                                Command="{Binding ElementName=root, Path=ViewModel.OpenAttachmentCommand}"
                                CommandParameter="{x:Bind}"
                                Text="{x:Bind domain:Translator.Buttons_Open}">
                                <MenuFlyoutItem.Icon>
                                    <PathIcon Data="{StaticResource OpenFilePathIcon}" />
                                </MenuFlyoutItem.Icon>
                            </MenuFlyoutItem>
                            <MenuFlyoutItem
                                Command="{Binding ElementName=root, Path=ViewModel.SaveAttachmentCommand}"
                                CommandParameter="{x:Bind}"
                                Text="{x:Bind domain:Translator.Buttons_Save}">
                                <MenuFlyoutItem.Icon>
                                    <PathIcon Data="{StaticResource SaveAttachmentPathIcon}" />
                                </MenuFlyoutItem.Icon>
                            </MenuFlyoutItem>
                        </MenuFlyout>
                    </Grid.ContextFlyout>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="40" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <!--  Icon  -->
                    <ContentControl
                        VerticalAlignment="Center"
                        Content="{x:Bind AttachmentType}"
                        ContentTemplateSelector="{StaticResource FileTypeIconSelector}" />

                    <!--  Name && Size  -->
                    <Grid
                        Grid.Column="1"
                        MaxWidth="200"
                        VerticalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <TextBlock
                            FontSize="13"
                            MaxLines="1"
                            Text="{x:Bind FileName}"
                            TextTrimming="CharacterEllipsis"
                            TextWrapping="Wrap" />

                        <TextBlock
                            Grid.Row="1"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Bottom"
                            FontSize="11"
                            Foreground="Gray"
                            Text="{x:Bind ReadableSize}" />
                    </Grid>
                </Grid>
                <muxc:ProgressBar
                    Grid.Row="1"
                    Margin="0,-5,0,0"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Top"
                    IsIndeterminate="{x:Bind IsBusy, Mode=OneWay}"
                    ShowError="False"
                    ShowPaused="False"
                    Visibility="{x:Bind IsBusy, Mode=OneWay}" />
            </Grid>
        </DataTemplate>
    </Page.Resources>

    <!--  Attachments and WebView2  -->
    <Grid x:Name="RendererGridFrame" RowSpacing="7">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Border
            Background="{ThemeResource WinoContentZoneBackgroud}"
            BorderBrush="{StaticResource CardStrokeColorDefaultBrush}"
            BorderThickness="1"
            CornerRadius="7">
            <Grid Margin="8">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid Grid.Row="0" Margin="5,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <TextBlock
                        VerticalAlignment="Center"
                        FontSize="18"
                        FontWeight="SemiBold"
                        IsTextSelectionEnabled="True"
                        Text="{x:Bind ViewModel.Subject, Mode=OneWay}"
                        TextWrapping="Wrap" />

                    <HyperlinkButton
                        Grid.Column="1"
                        Padding="5,1,5,1"
                        VerticalAlignment="Top"
                        Command="{x:Bind ViewModel.UnsubscribeCommand}"
                        Visibility="{x:Bind ViewModel.CanUnsubscribe, Mode=OneWay}">
                        <StackPanel Orientation="Horizontal" Spacing="3">
                            <Viewbox Width="16" Height="16">
                                <PathIcon
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Data="F1 M 3.75 4.902344 C 3.75 4.225262 3.885091 3.588867 4.155273 2.993164 C 4.425456 2.397461 4.790039 1.878256 5.249023 1.435547 C 5.708008 0.99284 6.238606 0.642904 6.84082 0.385742 C 7.443034 0.128582 8.079427 0 8.75 0 C 9.420572 0 10.056966 0.128582 10.65918 0.385742 C 11.261393 0.642904 11.791992 0.99284 12.250977 1.435547 C 12.709961 1.878256 13.074544 2.397461 13.344727 2.993164 C 13.614908 3.588867 13.75 4.225262 13.75 4.902344 C 13.75 5.332031 13.707682 5.740561 13.623047 6.12793 C 13.538411 6.5153 13.395182 6.901042 13.193359 7.285156 C 12.307942 7.434896 11.484375 7.734375 10.722656 8.183594 C 11.295572 7.819012 11.735025 7.353517 12.041016 6.787109 C 12.347005 6.220704 12.5 5.598959 12.5 4.921875 C 12.5 4.414062 12.399088 3.937176 12.197266 3.491211 C 11.995442 3.045248 11.722005 2.65625 11.376953 2.324219 C 11.0319 1.992188 10.633138 1.730145 10.180664 1.538086 C 9.728189 1.346029 9.251302 1.25 8.75 1.25 C 8.229166 1.25 7.740885 1.347656 7.285156 1.542969 C 6.829427 1.738281 6.432292 2.005209 6.09375 2.34375 C 5.755208 2.682293 5.488281 3.079428 5.292969 3.535156 C 5.097656 3.990887 5 4.479167 5 5 C 5 5.501303 5.096028 5.97819 5.288086 6.430664 C 5.480143 6.883139 5.742188 7.281902 6.074219 7.626953 C 6.40625 7.972006 6.795247 8.245443 7.241211 8.447266 C 7.687174 8.649089 8.164062 8.75 8.671875 8.75 C 9.029947 8.75 9.368489 8.710938 9.6875 8.632812 C 10.00651 8.554688 10.322266 8.424479 10.634766 8.242188 C 9.873047 8.704428 9.222005 9.290365 8.681641 10 L 8.662109 10 C 8.011067 10 7.389323 9.868164 6.796875 9.604492 C 6.204427 9.34082 5.681966 8.984375 5.229492 8.535156 C 4.777018 8.085938 4.417317 7.565104 4.150391 6.972656 C 3.883463 6.380209 3.75 5.755209 3.75 5.097656 Z M 8.75 14.375 C 8.75 13.600261 8.898111 12.871094 9.194336 12.1875 C 9.49056 11.503906 9.892578 10.908203 10.400391 10.400391 C 10.908203 9.892578 11.503906 9.490561 12.1875 9.194336 C 12.871093 8.898112 13.60026 8.75 14.375 8.75 C 14.889322 8.75 15.385741 8.816732 15.864258 8.950195 C 16.342773 9.083659 16.790363 9.272461 17.207031 9.516602 C 17.623697 9.760742 18.004557 10.055339 18.349609 10.400391 C 18.69466 10.745443 18.989258 11.126303 19.233398 11.542969 C 19.477539 11.959636 19.66634 12.407227 19.799805 12.885742 C 19.933268 13.364258 20 13.860678 20 14.375 C 20 15.14974 19.851887 15.878906 19.555664 16.5625 C 19.259439 17.246094 18.857422 17.841797 18.349609 18.349609 C 17.841797 18.857422 17.246094 19.259439 16.5625 19.555664 C 15.878906 19.851889 15.149739 20 14.375 20 C 13.59375 20 12.861328 19.853516 12.177734 19.560547 C 11.494141 19.267578 10.898438 18.867188 10.390625 18.359375 C 9.882812 17.851562 9.482422 17.255859 9.189453 16.572266 C 8.896484 15.888672 8.75 15.15625 8.75 14.375 Z M 0 13.701172 C 0 13.375651 0.066732 13.064779 0.200195 12.768555 C 0.333659 12.472331 0.512695 12.211914 0.737305 11.987305 C 0.961914 11.762695 1.222331 11.583659 1.518555 11.450195 C 1.814779 11.316732 2.125651 11.25 2.451172 11.25 L 7.900391 11.25 C 7.809244 11.451823 7.722981 11.656901 7.641602 11.865234 C 7.560221 12.073568 7.490234 12.285156 7.431641 12.5 L 2.5 12.5 C 2.324219 12.5 2.161458 12.532553 2.011719 12.597656 C 1.861979 12.662761 1.730143 12.752279 1.616211 12.866211 C 1.502279 12.980144 1.41276 13.111979 1.347656 13.261719 C 1.282552 13.411459 1.25 13.574219 1.25 13.75 C 1.25 14.407553 1.359049 14.986979 1.577148 15.488281 C 1.795247 15.989584 2.091471 16.425781 2.46582 16.796875 C 2.840169 17.167969 3.273112 17.478842 3.764648 17.729492 C 4.256185 17.980143 4.777018 18.180338 5.327148 18.330078 C 5.877278 18.479818 6.438802 18.58724 7.011719 18.652344 C 7.584635 18.717447 8.138021 18.75 8.671875 18.75 C 8.847656 18.977865 9.033203 19.192709 9.228516 19.394531 C 9.423828 19.596354 9.635416 19.785156 9.863281 19.960938 C 9.674479 19.973959 9.488932 19.983725 9.306641 19.990234 C 9.124349 19.996744 8.938802 20 8.75 20 C 8.333333 20 7.908528 19.986979 7.475586 19.960938 C 7.042643 19.934896 6.612955 19.887695 6.186523 19.819336 C 5.760091 19.750977 5.340169 19.65983 4.926758 19.545898 C 4.513346 19.431967 4.114583 19.287109 3.730469 19.111328 C 3.157552 18.850912 2.641602 18.543295 2.182617 18.188477 C 1.723633 17.833658 1.333008 17.431641 1.010742 16.982422 C 0.688477 16.533203 0.439453 16.035156 0.263672 15.488281 C 0.087891 14.941406 0 14.345703 0 13.701172 Z M 14.375 15.253906 L 16.123047 17.001953 C 16.246744 17.12565 16.393229 17.1875 16.5625 17.1875 C 16.73177 17.1875 16.878254 17.12565 17.001953 17.001953 C 17.12565 16.878256 17.1875 16.731771 17.1875 16.5625 C 17.1875 16.39323 17.12565 16.246746 17.001953 16.123047 L 15.263672 14.375 L 17.001953 12.626953 C 17.12565 12.503256 17.1875 12.356771 17.1875 12.1875 C 17.1875 12.018229 17.12565 11.871745 17.001953 11.748047 C 16.878254 11.62435 16.73177 11.5625 16.5625 11.5625 C 16.393229 11.5625 16.246744 11.62435 16.123047 11.748047 L 14.375 13.486328 L 12.626953 11.748047 C 12.503255 11.62435 12.356771 11.5625 12.1875 11.5625 C 12.018229 11.5625 11.871744 11.62435 11.748047 11.748047 C 11.624349 11.871745 11.5625 12.018229 11.5625 12.1875 C 11.5625 12.356771 11.624349 12.503256 11.748047 12.626953 L 13.496094 14.375 L 11.748047 16.123047 C 11.624349 16.246746 11.5625 16.39323 11.5625 16.5625 C 11.5625 16.731771 11.624349 16.878256 11.748047 17.001953 C 11.871744 17.12565 12.018229 17.1875 12.1875 17.1875 C 12.356771 17.1875 12.503255 17.12565 12.626953 17.001953 Z " />
                            </Viewbox>
                            <TextBlock VerticalAlignment="Center" Text="{x:Bind domain:Translator.Unsubscribe}" />
                        </StackPanel>
                    </HyperlinkButton>
                </Grid>
                <CommandBar
                    x:Name="RendererBar"
                    Grid.Row="1"
                    HorizontalContentAlignment="Stretch"
                    DefaultLabelPosition="Right"
                    DynamicOverflowItemsChanging="BarDynamicOverflowChanging"
                    IsDynamicOverflowEnabled="True"
                    OverflowButtonVisibility="Auto">
                    <interactivity:Interaction.Behaviors>
                        <local:BindableCommandBarBehavior ItemClickedCommand="{x:Bind ViewModel.OperationClickedCommand}" PrimaryCommands="{x:Bind ViewModel.MenuItems, Mode=OneWay}" />
                    </interactivity:Interaction.Behaviors>
                    <CommandBar.Content>
                        <Grid Padding="0,5">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <controls:ImagePreviewControl
                                x:Name="ContactImage"
                                Width="36"
                                Height="36"
                                FontSize="16"
                                FromAddress="{x:Bind ViewModel.FromAddress, Mode=OneWay}"
                                FromName="{x:Bind ViewModel.FromName, Mode=OneWay}"
                                SenderContactPicture="{x:Bind ViewModel.ContactPicture, Mode=OneWay}" />

                            <Grid
                                Grid.Column="1"
                                Margin="12,0"
                                VerticalAlignment="Center">
                                <StackPanel Spacing="1">
                                    <HyperlinkButton
                                        Margin="-6,-2"
                                        Padding="4,2"
                                        Command="{Binding ElementName=root, Path=ViewModel.CopyClipboardCommand}"
                                        CommandParameter="{x:Bind ViewModel.FromAddress, Mode=OneWay}"
                                        FontWeight="SemiBold">
                                        <Grid>
                                            <TextBlock Visibility="{x:Bind helpers:XamlHelpers.StringToVisibilityConverter(ViewModel.FromName), Mode=OneWay}">
                                                <Run Text="{x:Bind ViewModel.FromName, Mode=OneWay}" />
                                                <Run Text="&lt;" /><Run Text="{x:Bind ViewModel.FromAddress, Mode=OneWay}" /><Run Text="&gt;" />
                                            </TextBlock>
                                            <TextBlock Visibility="{x:Bind helpers:XamlHelpers.StringToVisibilityReversedConverter(ViewModel.FromName), Mode=OneWay}">
                                                <Run Text="{x:Bind ViewModel.FromAddress, Mode=OneWay}" />
                                            </TextBlock>
                                        </Grid>
                                    </HyperlinkButton>
                                    <TextBlock FontSize="12" Text="{x:Bind helpers:XamlHelpers.GetCreationDateString(ViewModel.CreationDate, ViewModel.PreferencesService.Prefer24HourTimeFormat), Mode=OneWay}" />
                                </StackPanel>
                            </Grid>
                        </Grid>
                    </CommandBar.Content>
                </CommandBar>

                <ScrollViewer
                    Grid.Row="2"
                    MaxHeight="150"
                    Margin="5,0">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Grid ColumnSpacing="6">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <TextBlock
                                Margin="0,1,0,0"
                                VerticalAlignment="Top"
                                FontWeight="SemiBold"
                                Text="{x:Bind domain:Translator.ComposerTo}"
                                Visibility="{x:Bind helpers:XamlHelpers.CountToVisibilityConverter(ViewModel.ToItems.Count), Mode=OneWay}" />

                            <ItemsControl
                                Grid.Column="1"
                                ItemTemplate="{StaticResource InternetAddressTemplate}"
                                ItemsSource="{x:Bind ViewModel.ToItems, Mode=OneWay}"
                                Visibility="{x:Bind helpers:XamlHelpers.CountToVisibilityConverter(ViewModel.ToItems.Count), Mode=OneWay}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <customcontrols:CustomWrapPanel />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                        </Grid>
                        <Grid Grid.Row="1" ColumnSpacing="6">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <TextBlock
                                Margin="0,1,0,0"
                                VerticalAlignment="Top"
                                FontWeight="SemiBold"
                                Text="Cc:"
                                Visibility="{x:Bind helpers:XamlHelpers.CountToVisibilityConverter(ViewModel.CcItems.Count), Mode=OneWay}" />
                            <ItemsControl
                                Grid.Column="1"
                                ItemTemplate="{StaticResource InternetAddressTemplate}"
                                ItemsSource="{x:Bind ViewModel.CcItems, Mode=OneWay}"
                                Visibility="{x:Bind helpers:XamlHelpers.CountToVisibilityConverter(ViewModel.CcItems.Count), Mode=OneWay}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <customcontrols:CustomWrapPanel />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                        </Grid>
                        <Grid Grid.Row="2" ColumnSpacing="6">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <TextBlock
                                Margin="0,1,0,0"
                                VerticalAlignment="Top"
                                FontWeight="SemiBold"
                                Text="Bcc:"
                                Visibility="{x:Bind helpers:XamlHelpers.CountToVisibilityConverter(ViewModel.BccItems.Count), Mode=OneWay}" />

                            <ItemsControl
                                Grid.Column="1"
                                ItemTemplate="{StaticResource InternetAddressTemplate}"
                                ItemsSource="{x:Bind ViewModel.BccItems, Mode=OneWay}"
                                Visibility="{x:Bind helpers:XamlHelpers.CountToVisibilityConverter(ViewModel.BccItems.Count), Mode=OneWay}">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <customcontrols:CustomWrapPanel />
                                        <!--<toolkit:WrapPanel Orientation="Horizontal" />-->
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                            </ItemsControl>
                        </Grid>
                    </Grid>
                </ScrollViewer>

                <!--  Attachments  -->
                <Grid Grid.Row="3">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <ListView
                        x:Name="AttachmentsListView"
                        Grid.Row="3"
                        Height="55"
                        x:Load="{x:Bind helpers:XamlHelpers.CountToBooleanConverter(ViewModel.Attachments.Count), Mode=OneWay}"
                        IsItemClickEnabled="True"
                        ItemClick="AttachmentClicked"
                        ItemTemplate="{StaticResource FileAttachmentTemplate}"
                        ItemsSource="{x:Bind ViewModel.Attachments, Mode=OneWay}"
                        SelectionMode="None">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <customcontrols:CustomWrapPanel />
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                    </ListView>

                    <HyperlinkButton
                        Grid.Column="1"
                        VerticalAlignment="Center"
                        Command="{x:Bind ViewModel.SaveAllAttachmentsCommand}"
                        Content="{x:Bind domain:Translator.Reader_SaveAllAttachmentButtonText}"
                        Visibility="{x:Bind helpers:XamlHelpers.CountToVisibilityConverterWithThreshold(ViewModel.Attachments.Count, 1), Mode=OneWay}" />
                </Grid>

                <muxc:InfoBar
                    x:Name="ImageLoadingDisabledMessage"
                    Grid.Row="4"
                    HorizontalContentAlignment="Stretch"
                    x:Load="{x:Bind ViewModel.IsImageRenderingDisabled, Mode=OneWay}"
                    IsOpen="True"
                    Message="{x:Bind domain:Translator.ImageRenderingDisabled}"
                    Severity="Warning">
                    <muxc:InfoBar.ActionButton>
                        <Button
                            HorizontalAlignment="Right"
                            Command="{x:Bind ViewModel.ForceImageLoadingCommand}"
                            Content="{x:Bind domain:Translator.Buttons_EnableImageRendering}" />
                    </muxc:InfoBar.ActionButton>
                </muxc:InfoBar>

                <muxc:ProgressBar
                    x:Name="DownloadingProgressBar"
                    Grid.Row="3"
                    Margin="12,1"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Top"
                    x:Load="{x:Bind ViewModel.ShouldDisplayDownloadProgress, Mode=OneWay}"
                    IsIndeterminate="{x:Bind ViewModel.IsIndetermineProgress, Mode=OneWay}"
                    Value="{x:Bind ViewModel.CurrentDownloadPercentage, Mode=OneWay}" />
            </Grid>
        </Border>

        <Border
            Grid.Row="1"
            Background="{ThemeResource WinoContentZoneBackgroud}"
            BorderBrush="{StaticResource CardStrokeColorDefaultBrush}"
            BorderThickness="1"
            CornerRadius="7">
            <Grid Margin="1" CornerRadius="7">
                <Grid Background="White" Visibility="{x:Bind IsDarkEditor, Converter={StaticResource ReverseBooleanToVisibilityConverter}, Mode=OneWay}" />

                <muxc:WebView2
                    x:Name="Chromium"
                    FontFamily="Segoe UI"
                    NavigationStarting="WebViewNavigationStarting" />

                <muxc:ProgressRing
                    Width="50"
                    Height="50"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    IsActive="{x:Bind ViewModel.ShouldDisplayDownloadProgress, Mode=OneWay}" />
            </Grid>
        </Border>
    </Grid>

</abstract:MailRenderingPageAbstract>
