<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ForzaUI"
                    xmlns:System="clr-namespace:System;assembly=mscorlib">

    <!-- Colors -->
    <Color x:Key="A_Color_NoticeDivider">#FF929292</Color>
    <Color x:Key="A_Color_Highlight_Unselected">#32FFFFFF</Color>

    <Size x:Key="A_Size_ClubNoticeboardGamerPicSizeParams">66,66</Size>

    <Style x:Key="A_Style_FZMaterial_NoticeHightlight_Unselected" TargetType="{x:Type local:FZMaterial}">
        <Setter Property="Color" Value="{StaticResource A_Color_Highlight_Unselected}" />
    </Style>
    
    <!-- Template for each Notice -->
    <ControlTemplate x:Key="A_ControlTemplate_Notice" TargetType="Control">
        <Grid>
            <local:RoutedEventCommand x:Name="SelectNoticeRoutedEventCommand"
                                      RoutedEvent="UIElement.MouseLeftButtonUp"
                                      Command="{Binding SelectCommand, RelativeSource={RelativeSource AncestorType=Page}}" />
            <DockPanel x:Name="A_DockPanel_NotificationItem"
                       Margin="4,5"
                       local:RoutedEventCommand.Action="{Binding ElementName=SelectNoticeRoutedEventCommand}">
                <local:FZMaterial x:Name="A_FZMaterial_NoticeHighlight"
                                  Style="{StaticResource A_Style_FZMaterial_NoticeHightlight_Unselected}"
                                  Width="20"
                                  DockPanel.Dock="Left" />
                <Grid>
                    <local:FZMaterial Color="{StaticResource A_Color_WhitePanel}"/>
                    <StackPanel>
                        <DockPanel>
                            <local:FZMaterial HorizontalAlignment="Right"
                                              VerticalAlignment="Top"
                                              Visibility="{Binding IsNew, Converter={StaticResource A_Converter_BoolToVis}}"
                                              Color="{StaticResource A_Color_TileSticker_Background}"
                                              Margin="0,0,0.5,0"
                                              DockPanel.Dock="Right">
                                <local:FZTextBlock
                                    x:Name="A_FZTextBlock_NewNotice"
                                    Text="{local:Loc Clan.IDS_NewMessage}"
                                    Style="{StaticResource A_Style_FZTextBlock_Heading_ExtraSmall}"
                                    FontSize="25"
                                    Color="{StaticResource A_Color_Tile_Text}"
                                    VerticalAlignment="Center" 
                                    HorizontalAlignment="Center"
                                    Margin="10,0,10,0"/>
                            </local:FZMaterial>

                            <local:FZTextBlock
                                x:Name="A_FZTextBlock_GamerTag" 
                                Text="{Binding UserProfile.FormattedGamertag}" 
                                Style="{StaticResource A_Style_FZTextBlock_Title_Large}" 
                                FontSize="41"
                                Color="{StaticResource A_Color_Tile_Text}"
                                VerticalAlignment="Center" HorizontalAlignment="Left" 
                                Stretch="Uniform"
                                StretchDirection="DownOnly"
                                Margin="18,9,18,0"/>
                        </DockPanel>

                        <StackPanel Margin="18,0,18,19">
                            <local:FZTextBlock
                                x:Name="A_FZTextBlock_TimeStamp" 
                                Text="{Binding TimeStamp}" 
                                Style="{StaticResource A_Style_FZTextBlock_Heading_Small_Tight}" 
                                Color="{StaticResource A_Color_Tile_Text}" 
                                FontSize="30"
                                VerticalAlignment="Bottom" HorizontalAlignment="Left"
                                Margin="1,-2,0,0"/>

                            <local:FZMaterial
                                x:Name="A_FZMaterial_Divider" 
                                Style="{StaticResource A_Style_FZMaterial_Panel_HorizontalDivider}"
                                Color="{StaticResource A_Color_NoticeDivider}"
                                Height="3"
                                Margin="2,10,2,13"/>

                            <local:FZTextBlock
                                x:Name="A_FZTextBlock_Message" 
                                Text="{Binding Message}" 
                                Style="{StaticResource A_Style_FZTextBlock_Body_Minimum}" 
                                Color="{StaticResource A_Color_Tile_Text}"
                                TextWrapping="Wrap"
                                Margin="1,0,1,0"/>
                        </StackPanel>
                    </StackPanel>
                </Grid>
            </DockPanel>
        </Grid>

        <ControlTemplate.Triggers>
            <Trigger Property="IsFocused" Value="True">
                <Setter TargetName="A_FZMaterial_Divider" 
                    Property="Color" Value="{StaticResource A_Color_Opaque_Highlight}"/>
                <Setter TargetName="A_FZMaterial_NoticeHighlight"
                        Property="Style" Value="{StaticResource A_Style_FZMaterial_AcrylicPanel_Highlight}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!-- Template for items on the LiveTile -->
    <DataTemplate x:Key="A_DataTemplate_Notice">
        <Grid Height="{StaticResource A_Double_MessageTileHeight}" Width="{StaticResource A_Double_Size_TileX4}">
            <local:FZMaterial x:Name="Background" Style="{StaticResource A_Style_FZMaterial_MessageTileBacking}"/>
            <DockPanel Style="{StaticResource A_Style_FrameworkElement_MessageTileContents}">
                <local:FZMaterial Width="66" Height="66" ImageSource="{Binding UserProfile, Converter={StaticResource A_GamerPicConverter}, ConverterParameter={StaticResource A_Size_ClubNoticeboardGamerPicSizeParams}}" Margin="6,0,6,0" DockPanel.Dock="Left"/>
                <StackPanel Style="{StaticResource A_Style_StackPanel_MessageTileText}">
                    <Viewbox Style="{StaticResource A_Style_Viewbox_MessageTileTopLine}">
                        <StackPanel Style="{StaticResource A_Style_StackPanel_MessageTileTopLine}">
                            <local:FZMaterial Width="16" Height="16" Data="{StaticResource A_FZGeometry_Circle}" Color="{StaticResource A_Color_Opaque_Highlight}" Visibility="{Binding IsNew, Converter={StaticResource A_Converter_BoolToVis}}" Margin="0,-8,13,-8"/>
                            <local:FZTextBlock Text="{Binding UserProfile.FormattedGamertag}" Style="{StaticResource A_Style_FZTextBlock_MessageTileTitle}"/>
                            <local:FZTextBlock Text="{Binding TimeStamp}" Style="{StaticResource A_Style_FZTextBlock_MessageTileTimeStamp}"/>
                        </StackPanel>
                    </Viewbox>
                    <local:FZTextBlock Text="{Binding Message}" Style="{StaticResource A_Style_FZTextBlock_MessageTileMessage}"/>
                </StackPanel>
            </DockPanel>
        </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding (ItemsControl.AlternationIndex), RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="1">
                <Setter TargetName="Background" Property="Opacity" Value="1"/>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

    <Style x:Key="A_Style_ListBox_Notices" TargetType="local:CommonListBox">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:CommonListBox">
                    <Grid x:Name="ListBoxContent">
                        <ScrollViewer CanContentScroll="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
                            <StackPanel Orientation="Vertical" IsItemsHost="True" ClipToBounds="True" OverridesDefaultStyle="True" Margin="0,24,0,0"/>
                        </ScrollViewer>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Colors -->
    <Color x:Key="A_Color_ScrollBarForeground">#FF202020</Color>
    <Color x:Key="A_Color_ScrollBarBackground">#4E202020</Color>

    <!-- Brushes -->
    <SolidColorBrush x:Key="A_Brush_ScrollBarForeground" Color="{StaticResource A_Color_ScrollBarForeground}" />
    <SolidColorBrush x:Key="A_Brush_ScrollBarBackground" Color="{StaticResource A_Color_ScrollBarBackground}" />

    <!-- Textures -->
    <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_HorizontalFadeViewer_MultiplyBlendFader" AlphaMode="Multiply" Softness="40" Unlit="True" />
    <ControlTemplate x:Key="A_ControlTemplate_HorizontalFadeViewer" TargetType="ContentControl" >
        <!--<Grid Effect="{StaticResource A_MotionBlurEffect}" local:MotionBlurEffect.MotionBlurPositionYControl="{Binding VerticalOffset, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:FZScrollViewer}}}">-->
        <Grid Effect="{StaticResource A_MotionBlurEffect}">
            <ContentPresenter Content="{TemplateBinding Content}" />
            <DockPanel ClipToBounds="True" Height="40" VerticalAlignment="Top" Visibility="{Binding IsAtTop, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:FZScrollViewer}}, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}">
                <local:FZMaterial Margin="-40,-15,-40,-40" Color="White" Preset="{StaticResource A_FZMaterialPresetRoundtangle_HorizontalFadeViewer_MultiplyBlendFader}" />
            </DockPanel>
            <DockPanel ClipToBounds="True" Height="40" VerticalAlignment="Bottom" Visibility="{Binding IsAtBottom, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:FZScrollViewer}}, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}">
                <local:FZMaterial Margin="-40,-40,-40,-15" Color="White" Preset="{StaticResource A_FZMaterialPresetRoundtangle_HorizontalFadeViewer_MultiplyBlendFader}" />
            </DockPanel>
        </Grid>
    </ControlTemplate>
    <Style x:Key="A_ContentControl_HorizontalFadeViewer" TargetType="ContentControl" >
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_HorizontalFadeViewer}" />
        <Setter Property="Focusable" Value="False" />
    </Style>
    
    <!-- ScrollViewer Style -->
    <ControlTemplate x:Key="A_ControlTemplate_FZScrollViewer_LargeScrollableNoticePanel" TargetType="{x:Type local:FZScrollViewer}">
        <Grid>
            <ContentControl Style="{StaticResource A_ContentControl_HorizontalFadeViewer}"
                Margin="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CommonListBox}}}">
                <ScrollContentPresenter HorizontalAlignment="Right" CanContentScroll="True" />
            </ContentControl>
            <ScrollBar x:Name="PART_VerticalScrollBar"
                    Background="{StaticResource A_Brush_ScrollBarBackground}"
                    Foreground="{StaticResource A_Brush_ScrollBarForeground}"
                    HorizontalAlignment="Right"
                    Minimum="0" 
                    Maximum="{TemplateBinding ScrollableHeight}" 
                    ViewportSize="{TemplateBinding ViewportHeight}" 
                    Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" 
                    Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" 
                    Margin="0, 0, -25, 0"
                    Style="{StaticResource A_Style_ScrollBar_Default}">
            </ScrollBar>
        </Grid>
    </ControlTemplate>

    <!-- ListBox Style -->
    <Style x:Key="A_Style_CommonListBox_LargeScrollableNoticePanel" TargetType="{x:Type local:CommonListBox}">
        <Setter Property="local:BindingProxy.A">
            <Setter.Value>
                <Thickness>0</Thickness>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:CommonListBox}">
                    <local:FZScrollViewer 
                                Style="{StaticResource {x:Static GridView.GridViewScrollViewerStyleKey}}" 
                                Template="{StaticResource A_ControlTemplate_FZScrollViewer_LargeScrollableNoticePanel}"
                                VerticalScrollBarVisibility="Auto"
                                CanContentScroll="True"
                                KeepSelectionOnScreen="True" >
                        <ItemsPresenter />
                    </local:FZScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>    

    <Style x:Key="A_Style_ContentControl_LargeScrollablePanel" TargetType="ContentControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContentControl">
                    <Grid>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_GlassPanel_Pill}" 
                                VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Focusable="False"/>

                        <ContentPresenter />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>