<Page x:Class="ForzaUI.Scenes.Anthem.A_MessageBox"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      mc:Ignorable="d"
      xmlns:local="clr-namespace:ForzaUI"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Popup}" />
    </local:UIPageTransitionManager.TransitionManager>

    <Page.Resources>
        <ResourceDictionary>
            <Style x:Key="A_Style_FZRun_Popup_BOLD"
                   TargetType="local:FZRun">
                <Setter Property="FontFamily"
                        Value="Horizon_C" />
            </Style>

            <Style x:Key="A_Style_FZRun_Popup_INLINE_INPUT"
                   TargetType="Control">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <local:ControllerButtonControl Style="{StaticResource A_Style_ControllerButtonControl_Default_ShowAlways}"
                                InputOverride="{Binding MarkupInput, FallbackValue={x:Null}}"
                                AllowMouseClick="False"
                                local:AncestorPropertySetter.Type="{x:Type local:AutoScrollPanel}"
                                local:AncestorPropertySetter.AttachedPropertyType="{x:Type local:MultiStringFormatter}"
                                local:AncestorPropertySetter.Property="Param0"
                                local:AncestorPropertySetter.Value="{Binding ScreenReaderName, RelativeSource={RelativeSource Self}}"
                                local:AncestorPropertySetter.AllowParentBindingFailure="{StaticResource A_Boolean_True}"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

        <local:StringSubstitutionConverter x:Key="A_Converter_PopupMarkupSubstitution">
            <local:StringSubstitution Find="[INLINE_INPUT]" Replace="{StaticResource A_String_0FormatString}"/>
        </local:StringSubstitutionConverter>

            <Style x:Key="A_Style_FZTextBlock_MessageBox_Text"
                   BasedOn="{StaticResource A_Style_FZTextBlock_PopupText}"
                   TargetType="local:FZTextBlock">
                <Setter Property="Width"
                        Value="Auto" />
                <Setter Property="Margin"
                        Value="0,0,0,12" />
                <Style.Triggers>
                    <Trigger Property="local:TextBlockInlineMarkup.Markup"
                             Value="{x:Null}">
                        <Setter Property="Visibility"
                                Value="Collapsed" />
                    </Trigger>
                    <Trigger Property="local:TextBlockInlineMarkup.Markup"
                             Value="">
                        <Setter Property="Visibility"
                                Value="Collapsed" />
                    </Trigger>
                </Style.Triggers>
            </Style>

        </ResourceDictionary>
    </Page.Resources>

    <Grid>
        <local:FZMaterialGlassCapture />
        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Popup_Background}"/>

        <!-- Bars -->
        <ContentControl x:Name="BottomBar"
                        Style="{StaticResource A_Style_ButtonBar}">
            <local:ControllerButtonPanel x:Name="HelpPanel"
                                         Layout="RightToLeft"
                                         HorizontalAlignment="Left"
                                         VerticalAlignment="Bottom"
                                         Background="{x:Null}">
            </local:ControllerButtonPanel>
        </ContentControl>

        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <StackPanel x:Name="MainContent"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Width="{StaticResource A_Double_MessageBox_Width}"
                        Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">

                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupTitleBlock}"
                                Content="{Binding Title}" />

                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupContentBlock}">
                    <StackPanel>
                        <local:AutoScrollPanel MaxHeight="500"
                                               Style="{StaticResource A_Style_AutoScrollPanel_Masked}"
                                               HorizontalContentAlignment="Center"
                                               local:MultiStringFormatter.Format="{Binding ScreenReaderMessage, Converter={StaticResource A_Converter_PopupMarkupSubstitution}}"
                                               local:ScreenReader.Line="{Binding (local:MultiStringFormatter.Output), RelativeSource={RelativeSource Self}, Converter={StaticResource A_Converter_TrimInlineMarkup}}"
                                               local:ScreenReader.Event="OnLoad"
                                               local:ScreenReader.LineType="ScreenDescription">
                            <FrameworkElement.Resources>
                                <ControlTemplate x:Key="A_ControlTemplate_AutoscrollTemplate_Dynamic">
                                    <local:FZTextBlock local:TextBlockInlineMarkup.Markup="{Binding Message}"
                                                       HorizontalAlignment="Center"
                                                       local:TextBlockInlineMarkup.ResourceBaseName="A_Style_FZRun_Popup_"
                                                       Style="{StaticResource A_Style_FZTextBlock_MessageBox_Text}" />
                                </ControlTemplate>
                            </FrameworkElement.Resources>
                        </local:AutoScrollPanel>

                        <Decorator Style="{StaticResource A_Style_Decorator_MessageBox_Separator}" Height="24"/>

                        <local:CommonListBox x:Name="Menu"
                                             Style="{StaticResource A_Style_ListBox_TextMenu_Default}"
                                             ItemsSource="{Binding Options}" Margin="0,0,0,-2"/>
                    </StackPanel>
                </ContentControl>
            </StackPanel>
        </Grid>
    </Grid>
</Page>
