<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">712</System:Double>
            <System:Double x:Key="A_Double_Height_MessagePanel">660</System:Double>
            <Thickness x:Key="A_Thickness_Margins_MessagePanel">0,175,0,48</Thickness>
            <local:FZBooleanToVisibilityConverter InvertResult="True"
                                                  x:Key="A_Converter_BoolToVis" />
            <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 BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}"
                   TargetType="local:FZTextBlock"
                   x:Key="A_Style_FZTextBlock_NoMessages">
                <Setter Property="local:ScreenReader.LineType"
                        Value="{x:Static local:ScreenReaderLineType.ItemState}" />
                <Setter Property="local:ScreenReader.Event"
                        Value="{x:Static local:ScreenReaderEvent.OnChange}" />
                <!-- Category index change causes screen reader OnChanged event so selecting 2 categories with no messages reads out the no messages text again -->
                <Setter Property="local:ScreenReader.Context"
                        Value="{Binding SelectedItem, ElementName=CategoryMenu}" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Messages.Count, Converter={StaticResource A_CompareConverter}, ConverterParameter=0}" Value="{x:Static local:CompareResult.Equal}">
                        <Setter Property="local:ScreenReader.Line"
                                Value="{Binding NoMessagesText}" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType=Page}}" Value="False">
                        <Setter Property="local:ScreenReader.Line"
                                Value="{x:Null}" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <Style BasedOn="{StaticResource A_Style_FZTextBlock_HorizonD}"
                   TargetType="local:FZTextBlock"
                   x:Key="A_Style_FZTextBlock_DataTemplateContent">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_SubHeader_Text}" />
                <Setter Property="CapHeight"
                        Value="14" />
                <Setter Property="TextWrapping"
                        Value="Wrap" />
                <Setter Property="Margin"
                        Value="30, 24" />
                <Setter Property="Text"
                        Value="{Binding SelectedMessageBody, RelativeSource={RelativeSource AncestorType=Page}}" />
                <Setter Property="Visibility"
                        Value="{Binding SelectedMessageBody, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_StringVisConverter}}" />
                <Setter Property="local:ScreenReader.Line"
                        Value="{Binding Text, RelativeSource={RelativeSource Self}}" />
                <Setter Property="local:ScreenReader.LineType"
                        Value="{x:Static local:ScreenReaderLineType.ItemState}" />
                <Setter Property="local:ScreenReader.Event"
                        Value="{x:Static local:ScreenReaderEvent.OnChange}" />
            </Style>
            <Style TargetType="ContentControl"
                   x:Key="A_Style_ContentControl_MessageDisplay">
                <Style.Resources>
                    <Style BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}"
                           TargetType="local:FZTextBlock"
                           x:Key="A_Style_FZTextBlock_SmallTitle">
                        <Setter Property="Color"
                                Value="{StaticResource A_Color_SubHeader_Text}" />
                        <Setter Property="FontSize"
                                Value="22" />
                        <Setter Property="HorizontalAlignment"
                                Value="Left" />
                        <Setter Property="Margin"
                                Value="0,0,0,10" />
                    </Style>
                    <Style BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}"
                           TargetType="local:FZTextBlock"
                           x:Key="A_Style_FZTextBlock_CarDetails">
                        <Setter Property="Color"
                                Value="{StaticResource A_Color_SubHeader_Text}" />
                        <Setter Property="CapHeight" Value="24"/>
                        <Setter Property="HorizontalAlignment"
                                Value="Left" />
                    </Style>
                    <Style BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}"
                           TargetType="local:FZTextBlock"
                           x:Key="A_Style_FZTextBlock_LargeDetail">
                        <Setter Property="Color"
                                Value="{StaticResource A_Color_SubHeader_Text}" />
                        <Setter Property="CapHeight" Value="24"/>
                        <Setter Property="HorizontalAlignment"
                                Value="Left" />
                    </Style>
                    <Style TargetType="ContentControl"
                           x:Key="A_Style_ContentControl_DefaultMessagePanel">
                        <Setter Property="Height"
                                Value="{StaticResource A_Double_Height_MessagePanel}" />
                        <Setter Property="Tag"
                                Value="{Binding MessageSummary}" />
                        <Setter Property="Template"
                                Value="{StaticResource A_ControlTemplate_SidePanel}" />
                        <Setter Property="Width"
                                Value="712" />
                        <Setter Property="Height"
                                Value="660" />
                        <Setter Property="local:ScreenReader.Line"
                                Value="{Binding Tag, RelativeSource={RelativeSource Self}}" />
                        <Setter Property="local:ScreenReader.LineType"
                                Value="{x:Static local:ScreenReaderLineType.ItemDescription}" />
                        <Setter Property="local:ScreenReader.Event"
                                Value="{x:Static local:ScreenReaderEvent.OnChange}" />
                    </Style>
                    <Style TargetType="local:FZTextBlock"
                           x:Key="A_Style_FZTextBlock_AuctionCarDetails">
                        <Setter Property="HorizontalAlignment"
                                Value="Left" />
                        <Setter Property="FontFamily"
                                Value="Horizon_A" />
                        <Setter Property="Color"
                                Value="{StaticResource A_Color_SubHeader_Text}" />
                        <Setter Property="CapHeight"
                                Value="24" />
                        <Setter Property="TextWrapping"
                                Value="Wrap" />
                        <Setter Property="Margin"
                                Value="0,0,0,14" />
                    </Style>

                    <ControlTemplate x:Key="A_ControlTemplate_SidePanelContent_Outerall" TargetType="ContentControl">
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_BodyPanel}" Preset="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterAll}">
                            <ContentPresenter/>
                        </local:FZMaterial>
                    </ControlTemplate>

                    <ControlTemplate TargetType="ContentControl"
                                     x:Key="A_ControlTemplate_ContentControl_Auction">
                        <DockPanel LastChildFill="True">
                            <ContentControl Template="{StaticResource A_ControlTemplate_SidePanelContent_Outerall}"
                                            DockPanel.Dock="Bottom"
                                            Width="712"
                                            Height="391">
                                <Grid Margin="25">
                                    <local:FZMaterial ImageSource="{Binding AuctionThumbnail, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}"
                                                      Stretch="Uniform"
                                                      GreedyMeasure="True"
                                                      HorizontalAlignment="Center"
                                                      VerticalAlignment="Center" />
                                    <StackPanel>
                                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_AuctionCarDetails}">
                                            <local:FZRun Text="{Binding MakeName, Converter={StaticResource A_StringToUpper}}" />
                                            <local:FZRun Text=" " />
                                            <local:FZRun FontFamily="Horizon_B"
                                                            Text="{Binding CarName, Converter={StaticResource A_StringToUpper}}" />
                                        </local:FZTextBlock>
                                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_AuctionCarDetails}"
                                                            FontFamily="Horizon_B"
                                                            Text="{Binding CarYear}" />
                                    </StackPanel>

                                    <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" />
                                </Grid>
                            </ContentControl>
                            <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}"
                                            Margin="0,0,0,5"
                                            Content="{TemplateBinding Content}"
                                            Height="Auto"/>
                        </DockPanel>
                    </ControlTemplate>
                    <Style TargetType="ContentControl"
                           x:Key="A_Style_ContentControl_AuctionMessagePanel">
                        <Setter Property="Height"
                                Value="{StaticResource A_Double_Height_MessagePanel}" />
                        <Setter Property="Template"
                                Value="{StaticResource A_ControlTemplate_ContentControl_Auction}" />
                        <Setter Property="Width"
                                Value="712" />
                    </Style>
                    <Style TargetType="local:FZTextBlock"
                           x:Key="A_Style_TextBlock_Credits_Cost">
                        <Setter Property="FontFamily"
                                Value="Horizon_A" />
                        <Setter Property="Stretch"
                                Value="Uniform" />
                        <Setter Property="StretchDirection"
                                Value="DownOnly" />
                        <Setter Property="CapHeight"
                                Value="24" />
                        <Setter Property="HorizontalAlignment"
                                Value="Left" />
                        <Setter Property="VerticalAlignment"
                                Value="Center" />
                        <Setter Property="Margin"
                                Value="12" />
                        <Setter Property="Color"
                                Value="{StaticResource A_Color_SubHeader_Text}" />
                    </Style>
                    <DataTemplate x:Key="A_DataTemplate_RivalsMessageTemplate">
                        <DockPanel LastChildFill="True"
                                   Height="{StaticResource A_Double_Height_MessagePanel}">
                            <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}"
                                            Height="Auto"
                                            DockPanel.Dock="Top"
                                            Margin="0,0,0,2"
                                            Tag="{local:Loc MessageCenter.IDS_TimeTrial_Beaten_Title}">
                                <StackPanel Margin="25">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_SmallTitle}"
                                                       Text="{local:Loc MessageCenter.IDS_Route}" Margin="0,0,0,12"/>
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_LargeDetail}"
                                                       Text="{Binding EventName}" />
                                </StackPanel>
                            </ContentControl>
                            <ContentControl DockPanel.Dock="Top"
                                            Template="{StaticResource A_ControlTemplate_SidePanelContent_Outerall}"
                                            Margin="0,0,0,2">
                                <StackPanel Margin="25">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_SmallTitle}"
                                                       Text="{local:Loc MessageCenter.IDS_Rival}" />
                                    <local:FZTextBlock Margin="0,0,0,42"
                                                       Style="{StaticResource A_Style_FZTextBlock_LargeDetail}"
                                                       Text="{Binding MessageSummary}" />
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_SmallTitle}"
                                                       Text="{local:Loc MessageCenter.IDS_Rivals_Car}" Margin="0,0,0,11"/>
                                    <Viewbox MaxWidth="580" StretchDirection="DownOnly" HorizontalAlignment="Left">
                                        <StackPanel Orientation="Horizontal">
                                            <local:FZTextBlock Margin="0,0,0,0"
                                                               Style="{StaticResource A_Style_FZTextBlock_CarDetails}"
                                                               Text="{Binding CarYear}" />
                                            <local:FZTextBlock Margin="5,0,0,0"
                                                               Style="{StaticResource A_Style_FZTextBlock_CarDetails}"
                                                               Text="{Binding MakeName}" />
                                        </StackPanel>
                                    </Viewbox>
                                    <local:FZTextBlock Margin="0,14,0,18"
                                       Style="{StaticResource A_Style_FZTextBlock_CarDetails}"
                                       Text="{Binding CarName}" />
                                    <StackPanel Height="42"
                                                Orientation="Horizontal">
                                        <ContentControl Style="{StaticResource A_Style_Control_CarClassBadge_Small}"
                                                        local:BindingProxy.A="{Binding PerformanceIndex}"
                                                        local:BindingProxy.B="{Binding CarClass}" Margin="0,0,12,0" />
                                    </StackPanel>
                                </StackPanel>
                            </ContentControl>
                            <ContentControl DockPanel.Dock="Bottom"
                                            Template="{StaticResource A_ControlTemplate_SidePanelContent_Outerall}"
                                            Margin="0,0,0,0">
                                <StackPanel Margin="25,30">
                                    <Grid Margin="0,0,0,30">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition />
                                            <ColumnDefinition />
                                        </Grid.ColumnDefinitions>
                                        <StackPanel>
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_SmallTitle}"
                                                               Text="{local:Loc MessageCenter.IDS_Rivals_TimeToBeat}" />
                                            <StackPanel Orientation="Horizontal">
                                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_LargeDetail}"
                                                               Text="{Binding TimeToBeat}" />
                                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_RivalDirtyIcon}" Tag="{Binding TimeToBeatIsDirty}"/>
                                            </StackPanel>
                                        </StackPanel>
                                        <StackPanel Grid.Column="1">
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_SmallTitle}"
                                                               Text="{local:Loc MessageCenter.IDS_Rivals_GapToRival}" />
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_LargeDetail}"
                                                               Text="{Binding GapToRival}" />
                                        </StackPanel>
                                    </Grid>

                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_SmallTitle}"
                                                       Text="{local:Loc MessageCenter.IDS_Rivals_Rewards}" Margin="0,0,0,10"/>
                                    <Grid Width="200"
                                          HorizontalAlignment="Left" VerticalAlignment="Center">
                                            <local:FZMaterial Color="{StaticResource A_Color_White}"
                                                              ImageSource="/ForzaUI;component/Textures/Anthem/Icons/CRIcon/CR_85_FilledCircle.png"
                                                              Width="36" Height="36"
                                                              HorizontalAlignment="Left" />
                                        <local:FZTextBlock Style="{StaticResource A_Style_TextBlock_Credits_Cost}" 
                                           Text="{Binding Bounty}" Margin="46,0"/>
                                    </Grid>
                                </StackPanel>
                            </ContentControl>
                        </DockPanel>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_DefaultMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_NewDLCMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_CarClubMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_GiftMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_DrivatarTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </ContentControl>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_AuctionMessageTemplate">
                        <ContentControl Style="{StaticResource A_Style_ContentControl_AuctionMessagePanel}">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_DataTemplateContent}" />
                        </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=ListBox_Menu}" />
                <Setter Property="Margin"
                        Value="6,0,0,0" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsPC, RelativeSource={RelativeSource AncestorType=Page}}"
                                 Value="True">
                        <Setter Property="Margin"
                                Value="53,0,0,0" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
            <Style TargetType="local:FZMaterial"
                   x:Key="A_Style_FZMaterial_MessageList">
                <Style.Triggers>
                    
                    <DataTrigger Binding="{Binding IsRead}"
                                 Value="True">
                        <Setter Property="Color"
                                Value="{StaticResource A_Color_MessageCenter_Icon_Read}" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding IsFocused, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}}" Value="True">
                        <Setter Property="Color" Value="{StaticResource A_Color_White}"/>
                    </DataTrigger> 
                </Style.Triggers>
                <Setter Property="VerticalAlignment"
                        Value="Center" />
                <Setter Property="Color"
                        Value="{StaticResource A_Color_MessageCenter_Icon}" />
            </Style>
            <Style TargetType="local:FZTextBlock" x:Key="A_Style_FZTextBlock_MessageList">
                <Setter Property="Color" Value="{StaticResource A_Color_MessageCenter_Text}" />
                <Setter Property="FontFamily" Value="Horizon_A" />
                <Setter Property="CapHeight" Value="14" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding IsFocused, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBoxItem}}}" Value="True">
                        <Setter Property="Color" Value="{StaticResource A_Color_White}"/>
                    </DataTrigger> 
                </Style.Triggers>
            </Style>
            
            <Style TargetType="ContentControl"
                   x:Key="A_Style_ContentControl_MessageIcon">
                <Style.Resources>
                    <DataTemplate x:Key="A_DataTemplate_DefaultMessageTemplate">
                        <local:FZMaterial ImageSource="/Textures/Anthem/Icons/MessageCentre/Message.png"
                                          Style="{StaticResource A_Style_FZMaterial_MessageList}" Width="25" Height="15"/>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_GiftMessageTemplate">
                        <local:FZMaterial ImageSource="/Textures/Anthem/SocialFeedIcons/Gift.png"
                                          Style="{StaticResource A_Style_FZMaterial_MessageList}" Width="25" Height="25"/>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_RivalsMessageTemplate">
                        <local:FZMaterial ImageSource="/Textures/Anthem/SocialFeedIcons/DrivatarReward.png"
                                          Style="{StaticResource A_Style_FZMaterial_MessageList}" Width="25" Height="25"/>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_CarClubMessageTemplate">
                        <local:FZMaterial ImageSource="/Textures/Anthem/SocialFeedIcons/CarClubInvite.png"
                                          Style="{StaticResource A_Style_FZMaterial_MessageList}" Width="25" Height="25"/>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_NewDLCMessageTemplate">
                        <local:FZMaterial ImageSource="/Textures/Anthem/SocialFeedIcons/Gift.png"
                                          Style="{StaticResource A_Style_FZMaterial_MessageList}" Width="25" Height="25"/>
                    </DataTemplate>
                    <DataTemplate x:Key="A_DataTemplate_AuctionMessageTemplate">
                        <local:FZMaterial ImageSource="/Textures/Anthem/Icons/MessageCentre/Auction_Message.png"
                                          Style="{StaticResource A_Style_FZMaterial_MessageList}" Width="25" Height="25"/>
                    </DataTemplate>
                </Style.Resources>
                <Setter Property="Margin"
                        Value="0,0,12,0" />
                <Setter Property="VerticalAlignment"
                        Value="Top" />
                <Setter Property="ContentTemplateSelector"
                        Value="{StaticResource A_DataTemplateSelector_MessageTypeSelector}"/>
                <Setter Property="MaxHeight" Value="660" />
            </Style>
            <DataTemplate x:Key="A_DataTemplate_ListBoxItem_MessageList">
                <Grid FocusVisualStyle="{x:Null}"
                      Focusable="True"
                      Height="48" x:Name="ListBoxMessage">
                    <Grid Margin="19,0,22,0">
                        <StackPanel HorizontalAlignment="Left"
                                    Orientation="Horizontal"
                                    VerticalAlignment="Center">
                            <ContentControl Content="{Binding}"
                                            Style="{StaticResource A_Style_ContentControl_MessageIcon}" />
                            <local:FZTextBlock MaxWidth="350"
                                               Style="{StaticResource A_Style_FZTextBlock_MessageList}"
                                               Text="{Binding MessageSummary}"
                                               TextTrimming="CharacterEllipsis"
                                               VerticalAlignment="Center" />
                        </StackPanel>
                        <local:FZTextBlock HorizontalAlignment="Right"
                                           Style="{StaticResource A_Style_FZTextBlock_MessageList}"
                                           Text="{Binding DateReceived}"
                                           VerticalAlignment="Center" />
                    </Grid>
                </Grid>
            </DataTemplate>
            <Style BasedOn="{StaticResource A_Style_ItemsSelector_TabTitle}"
                   TargetType="local:ItemsSelector"
                   x:Key="A_Style_ItemsSelector_Categories">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding CategoryCount}"
                                 Value="1">
                        <Setter Property="Visibility"
                                Value="Collapsed" />
                    </DataTrigger>
                    <DataTrigger Binding="{Binding CategoryCount}"
                                 Value="0">
                        <Setter Property="Visibility"
                                Value="Collapsed" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
           
            <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>  

            <Style BasedOn="{StaticResource A_Style_ListBoxItem_TextMenu}"
                   TargetType="ListBoxItem"
                   x:Key="A_Style_ListBoxItem_MessageList">
                <Setter Property="Template"
                        Value="{StaticResource A_ControlTemplate_TextMenu_Default}" />
                <Setter Property="local:BindingProxy.A"
                        Value="True" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding}"
                                 Value="{x:Null}">
                        <Setter Property="Tag"
                                Value="GroupHeader" />
                    </DataTrigger>
                </Style.Triggers>
            </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=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=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=ListBox_Menu}"
                                       Value="True" />
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="Visibility"
                                    TargetName="Loading"
                                    Value="Collapsed" />
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>

            <Style x:Key="A_Style_SocialFeed_CommonListBox"
                   TargetType="{x:Type local:CommonListBox}"
                   BasedOn="{StaticResource A_Style_ListBox_List_Default_ScrollBar}">
            </Style>
        </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 Template="{StaticResource A_ControlTemplate_ButtonBar}">
            <ContentControl Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}"
                            local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                            x:Name="DefaultHelpPanel" />
        </ContentControl>
        <local:NetworkCountdownControl Style="{StaticResource A_Style_NetworkCountdownControl_BucketListSetup}" />
        <Border Style="{StaticResource A_Style_Border_ScenePadding}" Margin="0,16,0,0"
                x:Name="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}"
                                        Tag="{Binding PreTitle}" />
                    </StackPanel>
                    <local:ItemsSelector ItemsSource="{Binding Categories}"
                                         SelectedIndex="{Binding SelectedCategoryIndex}"
                                         Style="{StaticResource A_Style_ItemsSelector_Categories}"
                                         x:Name="CategoryMenu"
                                         Margin="0, 28, 0, 12"/>
                    <StackPanel Height="{StaticResource A_Double_Height_MessagePanel}"
                                Orientation="Horizontal">
                        <Grid local:UIPageTransitionManager.TransitionIndex="1"
                              local:ZPanel.ZIndex="1">
                            <local:CommonListBox ItemContainerStyle="{StaticResource A_Style_ListBoxItem_MessageList}"
                                                 ItemTemplate="{StaticResource A_DataTemplate_ListBoxItem_MessageList}"
                                                 ItemsSource="{Binding Messages}"
                                                 SelectedIndex="1"
                                                 Style="{StaticResource A_Style_SocialFeed_CommonListBox}"
                                                 Width="815"
                                                 Height="663"
                                                 x:Name="ListBox_Menu" />
                            <ContentControl Template="{StaticResource A_ControlTemplate_MessageListOverlay}" />
                        </Grid>
                        <Grid local:UIPageTransitionManager.TransitionIndex="2">
                            <ContentControl Style="{StaticResource A_Style_ContentControl_MessageDisplay}"
                                            VerticalAlignment="Stretch" Margin="6,0,0,0"
                                            Visibility="{Binding Messages.Count, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
                            <local:FZMaterial HorizontalAlignment="Stretch" MinWidth="712"
                                            Style="{StaticResource A_Style_FZMaterial_GlassPanel_BodyPanel}"
                                            Preset="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterAll}"
                                            VerticalAlignment="Stretch"
                                            x:Name="NoMessages"
                                            Visibility="{Binding Messages.Count, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}"
                                            Margin="6,0,0,0">
                                <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_NoMessages}"
                                                    Text="{Binding NoMessagesText}"
                                                    VerticalAlignment="Center"
                                                    TextWrapping="Wrap" />
                                </Decorator>
                            </local:FZMaterial>
                        </Grid>
                    </StackPanel>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</Page>
