<Page DataContext="{Binding RelativeSource={RelativeSource Self}}"
      FlowDirection="LeftToRight"
      Style="{StaticResource A_Style_Page_Generic}"
      mc:Ignorable="d"
      x:Class="ForzaUI.A_SocialFeed"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:ForzaUI"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Page.Resources>
        <ResourceDictionary>
            <System:Double x:Key="A_Double_Width_MessagePanel">792</System:Double>
            <System:Double x:Key="A_Double_Height_MessagePanel">698</System:Double>
            <Thickness x:Key="A_Thickness_Margins_MessagePanel">0,175,0,48</Thickness>

            <Double x:Key="A_Double_MessageItem_Height">54</Double>

            <local:MessageTypeSelector x:Key="A_DataTemplateSelector_MessageTypeSelector" />
            <Style BasedOn="{StaticResource A_Style_ContentControl_Header}"
                   TargetType="ContentControl"
                   x:Key="A_Style_DescriptionPanelHeader">
                <Setter Property="Height"
                        Value="72" />
            </Style>

            <Style x:Key="A_Style_FZRun_MessageHighLight" TargetType="{x:Type local:FZRun}">
                <Setter Property="Color" Value="{StaticResource H_Color_Primary_Green}" />
            </Style>
            <Style x:Key="A_Style_FZRun_MessageBold" TargetType="{x:Type local:FZRun}">
                <Setter Property="FontFamily" Value="Horizon_C" />
            </Style>

            <MappingConverter x:Key="A_MappingConverter_MessageBody_Markup">
                <MappingConverterEntry Key="{NoCase HIGHLIGHT}" Value="{StaticResource A_Style_FZRun_MessageHighLight}"/>
                <MappingConverterEntry Key="{NoCase BOLD}" Value="{StaticResource A_Style_FZRun_MessageBold}"/>
            </MappingConverter>

            <Style x:Key="A_Style_FZTextBlock_DataTemplateContent" TargetType="local:FZTextBlock"
                BasedOn="{StaticResource A_Style_FZTextBlock_HorizonD}">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_SubHeader_Text}" />
                <Setter Property="CapHeight"
                        Value="14" />
                <Setter Property="TextWrapping"
                        Value="Wrap" />
                <Setter Property="Margin"
                        Value="24,30" />
                <Setter Property="MarkupConverter"
                        Value="{StaticResource A_MappingConverter_MessageBody_Markup}" />
                <Setter Property="Text"
                        Value="{Binding SelectedMessageBody, RelativeSource={RelativeSource AncestorType=Page}}" />
                <Setter Property="Visibility"
                        Value="{Binding SelectedMessageBody, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_StringVisConverter_UseHidden}}" />
            </Style>

            <Style x:Key="A_Style_FZRun_GamerTag" TargetType="{x:Type local:FZRun}">
                <Setter Property="FontFamily" Value="Horizon_D" />
            </Style>

            <MappingConverter x:Key="A_MappingConverter_Addressed_GamerTag">
                <MappingConverterEntry Key="{NoCase THIN}" Value="{StaticResource A_Style_FZRun_GamerTag}" />
            </MappingConverter>

            <Style x:Key="A_Style_FZTextBlock_MessageContent" TargetType="FZTextBlock"
                BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}">
                <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}"/>
                <Setter Property="CapHeight" Value="18"/>
                <Setter Property="MarkupConverter" Value="{StaticResource A_MappingConverter_Addressed_GamerTag}"/>
            </Style>

            <Style x:Key="A_Style_FZMaterial_MessageSeprator" TargetType="FZMaterial">
                <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}"/>
                <Setter Property="Opacity" Value="0.5"/>
                <Setter Property="Height" Value="2"/>
                <Setter Property="Width" Value="752"/>
                <Setter Property="Margin" Value="0,18"/>
            </Style>

            <MappingConverter x:Key="A_MessageType_to_Closed_Icon">
                <MappingConverterEntry Key="{x:Static MessageItemType.Message}" Value="/ForzaUI;component/Textures/Data_Bound/MessageCenter/Message_Closed.png"/>
                <MappingConverterEntry Key="{x:Static MessageItemType.Gift}" Value="/ForzaUI;component/Textures/Data_Bound/MessageCenter/Present_Closed.png"/>
            </MappingConverter>

            <MappingConverter x:Key="A_MessageType_to_Open_Icon">
                <MappingConverterEntry Key="{x:Static MessageItemType.Message}" Value="/ForzaUI;component/Textures/Data_Bound/MessageCenter/Message_Open.png"/>
                <MappingConverterEntry Key="{x:Static MessageItemType.Gift}" Value="/ForzaUI;component/Textures/Data_Bound/MessageCenter/Present_Open.png"/>
            </MappingConverter>

            <ControlTemplate x:Key="A_ControlTemplate_DefaultMessage" TargetType="ContentControl">
                <DockPanel Height="{StaticResource A_Double_Height_MessagePanel}">
                    <FZMaterial Preset="{StaticResource A_FZMaterialPresetGlass_High}"
                                Color="{StaticResource A_Color_GlassDescriptionContainer}"
                                Height="123"
                                VerticalAlignment="Top"
                                DockPanel.Dock="Top">
                        <DockPanel>
                            <StackPanel Margin="24,18,24,0">
                                <DockPanel x:Name="Title"
                                        VerticalAlignment="Center">
                                    <FZMaterial ImageSource="{Binding MessageType, Converter={StaticResource A_MessageType_to_Open_Icon}}"
                                                Width="32"
                                                Height="32"
                                                Visibility="{Binding Downloaded, RelativeSource={RelativeSource Self}, Converter={StaticResource A_FZBooleanToVisibilityConverter_UseHidden}}"/>
                                    <Decorator Width="12"/>
                                    <FZTextBlock Text="{Binding MessageSummary}"
                                                Style="{StaticResource A_Style_FZTextBlock_HorizonC}"
                                                Color="{StaticResource H_Color_Primary_White}"
                                                CapHeight="18"
                                                VerticalAlignment="Center"
                                                Margin="0,10,0,0"/>
                                    <FZTextBlock Text="{Binding DateReceived}"
                                                Style="{StaticResource A_Style_FZTextBlock_MessageContent}"
                                                HorizontalAlignment="Right"
                                                VerticalAlignment="Center"
                                                DockPanel.Dock="Right"
                                                Margin="0,10,0,0"/>
                                </DockPanel>
                                <FZMaterial Style="{StaticResource A_Style_FZMaterial_MessageSeprator}"/>
                                <FZTextBlock MultiStringFormatter.Format="{Loc MessageCenter.IDS_Message_Addressed_To_Gamertag}"
                                             MultiStringFormatter.Param0="{Binding GamerTag}"
                                             Text="{Binding (MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"
                                             FontFamily="Horizon_C"
                                             CapHeight="16"
                                             Style="{StaticResource A_Style_FZTextBlock_MessageContent}"/>
                            </StackPanel>
                        </DockPanel>
                    </FZMaterial>
                    <FZMaterial Preset="{StaticResource A_FZMaterialPresetGlass_High}"
                                Color="{StaticResource A_Color_GlassDescriptionContainer}"
                                Height="53"
                                DockPanel.Dock="Bottom">
                        <FZTextBlock MultiStringFormatter.Format="{Loc MessageCenter.IDS_Message_Addressed_From}"
                                     MultiStringFormatter.Param0="{Binding AddressedFrom}"
                                     Text="{Binding (MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"
                                     VerticalAlignment="Center"
                                     FontFamily="Horizon_C"
                                     Margin="25,0"
                                     CapHeight="16"
                                     Style="{StaticResource A_Style_FZTextBlock_MessageContent}"/>
                    </FZMaterial>
                    <FZMaterial Preset="{StaticResource A_FZMaterialPresetGlass_High}"
                                Color="{StaticResource H_Color_Glass_Purple_60pc}">
                        <Grid>
                            <FZMaterial Style="{StaticResource A_Style_FZMaterial_MessageSeprator}"
                                        VerticalAlignment="Top"
                                        Margin="0,-1,0,0"/>
                            <ContentPresenter/> 
                            <FZMaterial Style="{StaticResource A_Style_FZMaterial_MessageSeprator}"
                                        VerticalAlignment="Bottom"
                                        Margin="0,0,0,-1"/>
                        </Grid>
                    </FZMaterial>
                </DockPanel>
            </ControlTemplate>

            <Style x:Key="A_Style_ContentControl_DefaultMessagePanel" TargetType="ContentControl">
                <Setter Property="Height" Value="{StaticResource A_Double_Height_MessagePanel}" />
                <Setter Property="Template" Value="{StaticResource A_ControlTemplate_DefaultMessage}" />
                <Setter Property="Width" Value="{StaticResource A_Double_Width_MessagePanel}" />
            </Style>

            <ControlTemplate x:Key="A_ControlTemplate_ContentControl_Auction" TargetType="Control">
                <ControlTemplate.Resources>
                    <MappingConverter x:Key="A_Converter_AuctionHouseState_to_StateBox_Visibility"
                                      Default="{x:Static Visibility.Visible}">
                        <MappingConverterEntry Key="{x:Static AuctionState.Sold}" Value="{x:Static Visibility.Collapsed}"/>
                    </MappingConverter>

                    <MappingConverter x:Key="A_Converter_AuctionHouseState_to_FinalState_Visibility"
                                      Default="{x:Static Visibility.Visible}">
                        <MappingConverterEntry Key="{x:Static AuctionState.Won}" Value="{x:Static Visibility.Collapsed}"/>
                    </MappingConverter>
                </ControlTemplate.Resources>
                <Grid>
                    <DockPanel>
                        <FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" 
                                     DockPanel.Dock="Top"/>
                        <Grid>
                            <FZMaterial ImageSource="{Binding AuctionThumbnail, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}"
                                        Stretch="Uniform"
                                        GreedyMeasure="True"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Top" 
                                        Width="500"
                                        Visibility="{Binding AuctionThumbnail, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                                <Control Template="{StaticResource A_Template_Control_Auction_FinalState}"
                                         BindingProxy.A="{Binding AuctionHouseState}"
                                         Visibility="{Binding AuctionHouseState, Converter={StaticResource A_Converter_AuctionHouseState_to_FinalState_Visibility}}">
                                    <Control.Resources>
                                        <Double x:Key="A_Double_AuctionState_Text_CapHeight">30</Double>
                                        <Thickness x:Key="A_Margin_AuctionState_Text">25,3</Thickness>
                                    </Control.Resources>
                                </Control>         
                            </FZMaterial>
                            <ProgressBar Height="56"
                                        HorizontalAlignment="Center"
                                        IsIndeterminate="True"
                                        Visibility="{Binding AuctionThumbnail, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}"
                                        Style="{StaticResource A_Style_ProgressBar_WaitSpinner}"
                                        VerticalAlignment="Center" />
                            
                            <Control Template="{StaticResource A_Template_Control_Auction_StateBox}"
                                     BindingProxy.A="{Binding AuctionHouseState}"
                                     VerticalAlignment="Bottom"
                                     HorizontalAlignment="Center"
                                     Margin="0,0,0,80"
                                     Visibility="{Binding AuctionHouseState, Converter={StaticResource A_Converter_AuctionHouseState_to_StateBox_Visibility}}">
                                <Control.Resources>
                                    <Double x:Key="A_Double_AuctionState_Text_CapHeight">30</Double>
                                        <Thickness x:Key="A_Margin_AuctionState_Text">20,7</Thickness>
                                </Control.Resources>
                            </Control>
                        </Grid>
                    </DockPanel>
                </Grid>
            </ControlTemplate>

            <ControlTemplate x:Key="A_ControlTemplate_GiftMessage" TargetType="Control">
                <Grid>
                    <DockPanel>
                        <FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" 
                                     DockPanel.Dock="Top"/>
                        <StackPanel DockPanel.Dock="Bottom"
                                    Orientation="Horizontal"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center">
                            <ControllerButtonControl Style="{StaticResource A_Style_ControllerButtonControl_Standalone}"
                                                    MinHeight="20"
                                                    UseLargeIcon="True"
                                                    InputOverride="{Input Command=INPUTCMD_UI_OK_PRESS, Context=INPUTCONTEXT_UI}"
                                                    VerticalAlignment="Center"/>
                            <FZTextBlock Text="{Binding ButtonBarSelectionText, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}"
                                         Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}"
                                         Margin="5,25"/>
                        </StackPanel>
                        <Control Template="{StaticResource H_Template_XAMLReward}"
                                 Tag="{Binding MessageGift, NotifyOnTargetUpdated=True}"/>
                        
                    </DockPanel>
                </Grid>
            </ControlTemplate>

            <Style TargetType="ContentControl"
                   x:Key="A_Style_ContentControl_MessageDisplay">
                <Style.Resources>
                    <ControlTemplate x:Key="A_ControlTemplate_SidePanelContent_Outerall" TargetType="ContentControl">
                        <local:FZMaterial Style="{StaticResource H_Style_Container_GlassHighBlur_Description}"
                                          Margin="0">
                            <ContentPresenter/>
                        </local:FZMaterial>
                    </ControlTemplate>
                    <DataTemplate x:Key="PART_A_DataTemplate_DefaultMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="PART_A_DataTemplate_NewDLCMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="PART_A_DataTemplate_CarClubMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="PART_A_DataTemplate_GiftMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <Control Template="{StaticResource A_ControlTemplate_GiftMessage}"/>
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="PART_A_DataTemplate_DrivatarTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="PART_A_DataTemplate_RivalsMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="PART_A_DataTemplate_AuctionMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <Control Template="{StaticResource A_ControlTemplate_ContentControl_Auction}"/>
                        </ContentControl>
                    </DataTemplate>
                </Style.Resources>
                <Setter Property="HorizontalAlignment"
                        Value="Right" />
                <Setter Property="VerticalAlignment"
                        Value="Stretch" />
                <Setter Property="Margin"
                        Value="{StaticResource A_Thickness_Margins_MessagePanel}" />
                <Setter Property="ContentTemplateSelector"
                        Value="{StaticResource A_DataTemplateSelector_MessageTypeSelector}" />
                <Setter Property="Content"
                        Value="{Binding SelectedItem, ElementName=PART_ListBox_Menu}" />
                <Setter Property="Margin"
                        Value="6,0,0,0" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsPC, Source={StaticResource PART_UISceneContext}}"
                                 Value="True">
                        <Setter Property="Margin"
                                Value="53,0,0,0" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="A_Style_Control_EmptyItemStyle_MessageList"
                   TargetType="Control">
                <Setter Property="Focusable"
                        Value="False"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Control">
                            <DockPanel VerticalAlignment="Stretch" Margin="0,2,0,2">
                                <FZMaterial Preset="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_Base}"
                                            Color="{StaticResource A_Color_GlassDescriptionContainer}"/>
                            </DockPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_FZTextBlock_MessageList" TargetType="local:FZTextBlock" 
                   BasedOn="{StaticResource A_Style_FZTextBlock_OptionText}">
                <Setter Property="Color" Value="{StaticResource A_Color_MessageCenter_Text}" />
                <Setter Property="FontFamily" Value="Horizon_B" />
                <Setter Property="CapHeight" Value="18" />
                <Setter Property="Margin" Value="19,0" />
            </Style>
            
            <DataTemplate x:Key="A_DataTemplate_ListBoxItem_MessageList">
                <Grid x:Name="ListBoxMessage"
                      FocusVisualStyle="{x:Null}"
                      Focusable="True"
                      Height="{StaticResource A_Double_MessageItem_Height}">
                    <Grid Margin="19,0,22,0">
                        <StackPanel HorizontalAlignment="Left"
                                    Orientation="Horizontal"
                                    VerticalAlignment="Center">
                            <FZMaterial x:Name="Icon"
                                        ImageSource="{Binding MessageType, Converter={StaticResource A_MessageType_to_Closed_Icon}}"
                                        Color="{StaticResource H_Color_Primary_Black}"
                                        VerticalAlignment="Center"
                                        Width="24"
                                        Height="24"
                                        Margin="0,-5,0,0"
                                        Visibility="{Binding Downloaded, RelativeSource={RelativeSource Self}, Converter={FZBooleanToVisibilityConverter UseHidden=True}}"/>
                            <FZTextBlock x:Name="MessageSummary"
                                         MaxWidth="350"
                                         Style="{StaticResource A_Style_FZTextBlock_MessageList}"
                                         Text="{Binding MessageSummary}"
                                         TextTrimming="CharacterEllipsis"
                                         VerticalAlignment="Center" />
                        </StackPanel>
                        <FZTextBlock x:Name="Date"
                                     HorizontalAlignment="Right"
                                     Style="{StaticResource A_Style_FZTextBlock_MessageList}"
                                     Color="{StaticResource H_Color_Grey}"
                                     Text="{Binding DateReceived}"
                                     VerticalAlignment="Center" />
                    </Grid>
                </Grid>
                <DataTemplate.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding IsRead}" Value="True"/>
                            <Condition Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}" Value="False"/>
                        </MultiDataTrigger.Conditions>
                        <Setter TargetName="Icon" Property="Color" Value="{StaticResource H_Color_Grey}"/>
                        <Setter TargetName="MessageSummary" Property="Color" Value="{StaticResource H_Color_Grey}"/>
                    </MultiDataTrigger>
                    <DataTrigger Binding="{Binding IsRead}" Value="True">
                        <Setter TargetName="Icon" Property="ImageSource" Value="{Binding MessageType, Converter={StaticResource A_MessageType_to_Open_Icon}}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}" Value="True">
                        <Setter TargetName="Icon" Property="Color" Value="{StaticResource H_Color_Primary_White}"/>
                        <Setter TargetName="Date" Property="Color" Value="{StaticResource H_Color_Primary_White}"/>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
           
            <Style BasedOn="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                   TargetType="ContentControl"
                   x:Key="A_Style_ContentControl_ScreenTitleBlock_SocialFeed">
                <Setter Property="Visibility" Value="{Binding Title, Converter={StaticResource A_StringVisConverter}}" />  
                <Setter Property="local:BindingProxy.A" Value="{Binding TitleIconSource}"/>
            </Style>


            <ControlTemplate TargetType="ContentControl"
                             x:Key="A_ControlTemplate_MessageListOverlay">
                <Grid>
                    <local:FZMaterial HorizontalAlignment="Stretch"
                                      VerticalAlignment="Stretch"
                                      Style="{StaticResource A_Style_FZMaterial_GlassPanel_BodyPanel}"
                                      x:Name="Loading">
                        <ProgressBar HorizontalAlignment="Center"
                                     IsIndeterminate="True"
                                     Style="{StaticResource A_Style_ProgressBar_WaitSpinner}"
                                     VerticalAlignment="Center"
                                     x:Name="Spinner"/>
                    </local:FZMaterial>
                </Grid>
                <ControlTemplate.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding LoadingMessages}"
                                       Value="True" />
                            <Condition Binding="{Binding HasItems, ElementName=PART_ListBox_Menu}"
                                       Value="False" />
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="Visibility"
                                    TargetName="Loading"
                                    Value="Visible" />
                        </MultiDataTrigger.Setters>
                        <MultiDataTrigger.EnterActions>
                            <BeginStoryboard>
                                <local:UIStoryboard>
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Spinner"
                                                                   FillBehavior="Stop"
                                                                   Storyboard.TargetProperty="Opacity">
                                        <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                                                Value="0" />
                                        <DiscreteDoubleKeyFrame KeyTime="0:0:1"
                                                                Value="0" />
                                        <EasingDoubleKeyFrame KeyTime="0:0:1.2"
                                                              Value="1" />
                                    </DoubleAnimationUsingKeyFrames>
                                </local:UIStoryboard>
                            </BeginStoryboard>
                        </MultiDataTrigger.EnterActions>
                    </MultiDataTrigger>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding LoadingMessages}"
                                       Value="False" />
                            <Condition Binding="{Binding HasItems, ElementName=PART_ListBox_Menu}"
                                       Value="False" />
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="Visibility"
                                    TargetName="Loading"
                                    Value="Collapsed" />
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding LoadingMessages}"
                                       Value="False" />
                            <Condition Binding="{Binding HasItems, ElementName=PART_ListBox_Menu}"
                                       Value="True" />
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="Visibility"
                                    TargetName="Loading"
                                    Value="Collapsed" />
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>

        </ResourceDictionary>
    </Page.Resources>
    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}"/>
    </local:UIPageTransitionManager.TransitionManager>
    <Grid>
        <!-- Background Blur -->
        <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />
        <local:PlayerBarControl Style="{StaticResource A_Style_PlayerBarControl}"
                        x:Name="TopBar" />
        <ContentControl Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}"
                            local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                            x:Name="PART_DefaultHelpPanel" />
        </ContentControl>
        <local:NetworkCountdownControl Style="{StaticResource A_Style_NetworkCountdownControl_BucketListSetup}" />
        <Border Style="{StaticResource A_Style_Border_ScenePadding}" Margin="0,16,0,0"
                x:Name="PART_LayoutRoot">
            <Grid Focusable="False"
                  Style="{StaticResource A_Style_FrameworkElement_ScreenTilt}">
                <StackPanel HorizontalAlignment="Center"
                            Orientation="Vertical"
                            Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                            VerticalAlignment="Center">
                    <StackPanel Orientation="Horizontal"
                                local:UIPageTransitionManager.TransitionIndex="0">
                        <ContentControl Content="{Binding Title}"
                                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock_SocialFeed}"
										Focusable="False"
                                        Tag="{Binding PreTitle}" />
                    </StackPanel>
                    <Decorator Visibility="{Binding CategoryCount, Converter={StaticResource H_CollapseIfZeroOrOne}}">
                        <Decorator x:Name="Decorator_CategoryRibbon"
                              Margin="0,0,0,4"
                              VerticalAlignment="Top"
                              HorizontalAlignment="Left"
                              Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_1}">
                            <FZTabButtonsSelector x:Name="PART_CategoryMenu"
                                                  Style="{StaticResource H_Style_TabBar}"
                                                  ItemsSource="{Binding Categories}"
                                                  SelectedIndex="{Binding SelectedCategoryIndex}" 
                                                  Width="1616"
                                                  HorizontalAlignment="Stretch"
                                                  HorizontalContentAlignment="Left"/>
                        </Decorator>
                    </Decorator>
                    <StackPanel Height="{StaticResource A_Double_Height_MessagePanel}"
                                Orientation="Horizontal">
                        <Grid local:UIPageTransitionManager.TransitionIndex="1"
                              local:ZPanel.ZIndex="1">
                            <WrapListBox
                                x:Name="PART_ListBox_Menu" 
                                Width="800"
                                Height="{StaticResource A_Double_Height_MessagePanel}"
                                Template="{StaticResource H_ControlTemplate_TextMenu_Default}"
                                ScrollOrientation="Vertical"
                                ItemHeight="{StaticResource A_Double_MessageItem_Height}"
                                ItemWidth="800"
                                SelectedIndex="0"
                                WrapSelection="True"
                                AlternationCount="10000"
                                ItemsSource="{Binding Messages}"
                                ItemTemplate="{StaticResource A_DataTemplate_ListBoxItem_MessageList}"
                                ItemContainerStyle="{StaticResource A_Style_ListBoxItem_TextMenu_Gaps}"
                                EmptyItemStyle="{StaticResource A_Style_Control_EmptyItemStyle_MessageList}"/>
                            <ContentControl Template="{StaticResource A_ControlTemplate_MessageListOverlay}" />
                        </Grid>
                        <Decorator Width="8" />
                        <ScrollBar
                            Style="{StaticResource A_Style_ScrollBar_Default}"
                            Minimum="{Binding ScrollWindowMin, ElementName=PART_ListBox_Menu}"
                            Maximum="{Binding ScrollWindowMax, ElementName=PART_ListBox_Menu}"
                            Value="{Binding ScrollWindowValue, ElementName=PART_ListBox_Menu, Mode=TwoWay}"
                            ViewportSize="{Binding ScrollWindowSize, ElementName=PART_ListBox_Menu}" />
                        <Decorator Width="8" />
                        <Grid local:UIPageTransitionManager.TransitionIndex="2"
                              Height="{StaticResource A_Double_Height_MessagePanel}">
                            <ContentControl Style="{StaticResource A_Style_ContentControl_MessageDisplay}"
                                            VerticalAlignment="Stretch" 
                                            Margin="0,0,0,0"
                                            Visibility="{Binding Messages.Count, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
                            <local:FZMaterial HorizontalAlignment="Stretch" 
                                            MinWidth="{StaticResource A_Double_Width_MessagePanel}"
                                            Preset="{StaticResource H_GlassRoundtangle_1px}"
                                            Color="{StaticResource H_Color_Glass_Purple_20pc}"
                                            VerticalAlignment="Stretch"
                                            x:Name="NoMessages"
                                            Visibility="{Binding Messages.Count, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}">
                                <Decorator Visibility="{Binding LoadingMessages, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}" 
                                           Margin="30">
                                    <local:FZTextBlock Color="{StaticResource A_Color_SubHeader_Text}"
                                                    FontSize="42"
                                                    HorizontalAlignment="Center"
                                                    TextAlignment="Center"
                                                    Style="{StaticResource A_Style_FZTextBlock_HorizonB}"
                                                    Text="{Binding NoMessagesText}"
                                                    VerticalAlignment="Center"
                                                    TextWrapping="Wrap"/>
                                </Decorator>
                            </local:FZMaterial>
                        </Grid>
                    </StackPanel>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</Page>
