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

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

    <Page.Resources>
        <local:UIStoryboard x:Key="A_Storyboard_MapPinOpacity_BlendValueInputChanged">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="{x:Null}"
                                           FillBehavior="HoldEnd"
                                           Storyboard.TargetProperty="(local:BlendValue.Blend)">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="0" />
                <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                      Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </local:UIStoryboard>

        <local:UIStoryboard x:Key="A_Storyboard_FadeInObjective">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="{x:Null}"
                                           FillBehavior="HoldEnd"
                                           Storyboard.TargetProperty="(Opacity)">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="0" />
                <EasingDoubleKeyFrame KeyTime="0:0:1.0"
                                      Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </local:UIStoryboard>

        <local:UIStoryboard x:Key="A_Storyboard_FadeInInstruction">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="{x:Null}"
                                           FillBehavior="HoldEnd"
                                           Storyboard.TargetProperty="(Opacity)">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="0" />
                <EasingDoubleKeyFrame KeyTime="0:0:1.0"
                                      Value="1">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </local:UIStoryboard>

        <local:UIStoryboard x:Key="A_Storyboard_FadeOutObjective">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="{x:Null}"
                                           FillBehavior="HoldEnd"
                                           Storyboard.TargetProperty="(Opacity)">
                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                        Value="1" />
                <EasingDoubleKeyFrame KeyTime="0:0:1.0"
                                      Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <QuarticEase EasingMode="EaseOut" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </local:UIStoryboard>

        <Style x:Key="A_Style_PinContainer"
               TargetType="FrameworkElement">
            <Setter Property="RenderTransform">
                <Setter.Value>
                    <TranslateTransform X="{Binding PinPosX, RelativeSource={RelativeSource AncestorType=Page}}"
                                        Y="{Binding PinPosY, RelativeSource={RelativeSource AncestorType=Page}}" />
                </Setter.Value>
            </Setter>
            <Setter Property="local:BlendValue.InputChangedStoryboard" Value="{StaticResource A_Storyboard_MapPinOpacity_BlendValueInputChanged}" />
            <Setter Property="local:BlendValue.Input" Value="{Binding CanShowPin, RelativeSource={RelativeSource AncestorType=Page}}" />
            <Setter Property="local:BlendValue.BlendFromPreviousOutput" Value="True" />
            <Setter Property="local:BlendValue.ShouldSkipInitialInputChange" Value="False" />
            <Setter Property="Opacity" Value="{Binding (local:BlendValue.Output), RelativeSource={RelativeSource Self}}" />
            <Setter Property="Visibility" Value="{Binding CanShowPin, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter_UseHidden}}" />
        </Style>
        <Style x:Key="A_Style_FZRun_MapFestivalInstruction_HIGHLIGHT"
               TargetType="local:FZRun">
            <Setter Property="Color"
                Value="#FFFFF539" />
        </Style>

        <Style x:Key="A_Style_FZMaterial_ObjectiveBacking"
           TargetType="{x:Type local:FZMaterial}">
            <Setter Property="Color" Value="{StaticResource A_Color_CurrencyValueContainer_Dark}"/>
            <Setter Property="Height" Value="{StaticResource A_Double_Size_PlayerBar}" />
            <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}" />
            <Setter Property="Opacity" Value="0"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding EnableFadeEffects}" Value="False">
                    <Setter Property="Opacity" Value="1"/>
                </DataTrigger>
                
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding EnableFadeEffects}" Value="True"/>
                        <Condition Binding="{Binding FadeObjectiveIn}" Value="True"/>
                    </MultiDataTrigger.Conditions>
                    <MultiDataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_FadeInObjective}"/>
                    </MultiDataTrigger.EnterActions>
                    <MultiDataTrigger.ExitActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_FadeOutObjective}"/>
                    </MultiDataTrigger.ExitActions>
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZMaterial_InstructionBacking" TargetType="{x:Type local:FZMaterial}">
            <Setter Property="Margin" Value="50,40,0,0"/>
            <Setter Property="Color" Value="{StaticResource A_Color_ButtonBar_Background}"/>
            <Setter Property="Height" Value="{StaticResource A_Double_Size_PlayerBar}" />
            <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}" />
            <Style.Triggers>
                <!--Moves towards edge if activity panel is not there -->
                <DataTrigger Binding="{Binding ActivityPanel}" Value="{x:Null}">
                    <Setter Property="Margin" Value="-2,0,0,0"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding ActivityPanel.IsEnabled}" Value="False">
                    <Setter Property="Margin" Value="-2,0,0,0"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Visibility, RelativeSource={RelativeSource Self}}" Value="{x:Static Visibility.Visible}">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_FadeInInstruction}"/>
                    </DataTrigger.EnterActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <!-- Copied from shared_bars.xaml to add a viewbox for languages with really long strings on the button bar -->
        <ControlTemplate x:Key="A_ControlTemplate_ButtonBar_Map" TargetType="ContentControl">
            <Grid RenderTransformOrigin="0.5,1.0"
                  VerticalAlignment="Bottom"
                  Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
                <Viewbox StretchDirection="DownOnly"
                         VerticalAlignment="Bottom"
                         HorizontalAlignment="Left"
                         Margin="{StaticResource A_Thickness_Margin_ButtonBar}">
                    <Grid VerticalAlignment="Bottom"
                          HorizontalAlignment="Left">
                        <local:FZMaterial x:Name="ControllerStyleBackground"
                                          Style="{StaticResource A_Style_ControllerButton_Background}"
                                          Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_ConsoleButtonBarBackground_All}">
                            <ContentPresenter x:Name="ControllerButtonPanel"
                                              Margin="4,0,0,0"
                                              VerticalAlignment="Center" />
                        </local:FZMaterial>
                    </Grid>
                </Viewbox>
            </Grid>
            <ControlTemplate.Triggers>
                <DataTrigger Binding="{Binding IsControllerActiveInput, RelativeSource={RelativeSource AncestorType=Page}}"
                             Value="False">
                    <Setter TargetName="ControllerStyleBackground"
                            Property="Color"
                            Value="#00000000" />
                    <Setter TargetName="ControllerButtonPanel"
                            Property="Margin"
                            Value="0" />
                </DataTrigger>
                <DataTrigger Binding="{Binding ActualWidth, ElementName=ControllerButtonPanel}"
                             Value="0">
                    <Setter TargetName="ControllerButtonPanel"
                            Property="Margin"
                            Value="0" />
                </DataTrigger>
                <EventTrigger RoutedEvent="ControllerButtonPanel.ShowControllerButtonPanel">
                    <local:BeginUIStoryboard Storyboard="{StaticResource ShowControllerButtonPanel}"/>
                </EventTrigger>
                <EventTrigger RoutedEvent="ControllerButtonPanel.ShowControllerButtonPanelInstant">
                    <local:BeginUIStoryboard Storyboard="{StaticResource ShowControllerButtonPanelInstant}"/>
                </EventTrigger>
                <EventTrigger RoutedEvent="ControllerButtonPanel.HideControllerButtonPanel">
                    <local:BeginUIStoryboard Storyboard="{StaticResource HideControllerButtonPanel}"/>
                </EventTrigger>
                <EventTrigger RoutedEvent="ControllerButtonPanel.HideControllerButtonPanelInstant">
                    <local:BeginUIStoryboard Storyboard="{StaticResource HideControllerButtonPanelInstant}"/>
                </EventTrigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <Style x:Key="A_Style_MapViewControllerInteractive_DefaultController"
               TargetType="{x:Type local:MapViewControllerInteractive}">
            <Setter Property="MinMapDistance" Value="1780" />
            <Setter Property="MaxMapDistance" Value="2750" />
            <Setter Property="MinCursorSpeed" Value="5000" />
            <Setter Property="MaxCursorSpeed" Value="7350" />
            <Setter Property="MinCursorZoom" Value="0" />
            <Setter Property="MaxCursorZoom" Value="1" />
            <Setter Property="ZoomDefault" Value="0" />
            <Setter Property="ZoomSpeed" Value="30000.0" />
            <Setter Property="MouseZoomSpeed" Value="1500.0" />
            <Setter Property="InputAccelerationStart" Value="1" />
            <Setter Property="InputAccelerationTime" Value="1" />
            <Setter Property="InputLinearity" Value="2" />
            <Setter Property="MapInteriaSpring" Value="100" />
            <Setter Property="MapInteriaDamping" Value="20" />
            <Setter Property="MapZoomInteriaSpring" Value="300" />
            <Setter Property="MapZoomInteriaDamping" Value="40" />
            <Setter Property="MapDeadArea" Value=".4" />
            <Setter Property="CursorDistance" Value="200" />
            <Setter Property="CursorScaleFactor" Value="0.75" />
        </Style>

        <Style x:Key="A_Style_AutoScrollPanel_BrickChallengePinTitle" BasedOn="{StaticResource A_Style_AutoScrollPanel_Masked}" TargetType="local:AutoScrollPanel">
            <Setter Property="InitialPause" Value="0:0:2.0" />
            <Setter Property="ScrollSeparation" Value="40" />
            <Setter Property="MaxHeight" Value="30" />
            <Setter Property="Orientation" Value="Horizontal" />
            <Setter Property="AnimationContext" Value="{Binding Title}" />
            <Style.Resources>
                <ControlTemplate x:Key="A_ControlTemplate_AutoscrollTemplate_Dynamic">
                    <local:FZTextBlock Text="{Binding Title, Converter={StaticResource A_StringToUpper}}"
                                       Style="{StaticResource A_Style_FZTextBlock_MapPin_TitleText}" />
                </ControlTemplate>
            </Style.Resources>
        </Style>

        <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_PinBottom_Complete"
                                           BasedOn="{StaticResource A_FZMaterialPreset_FlatPanel_Base}"
                                           GradientColorA="#B78432"
                                           GradientColorB="#FCE270"
                                           GradientAngle="90"
                                           CornerRadius="{StaticResource A_CornerRadius_Outer_Bottom}"/>

        <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_PinBottom_Pinned"
                                           BasedOn="{StaticResource A_FZMaterialPresetRoundtangle_GradientHighlight}"
                                           CornerRadius="{StaticResource A_CornerRadius_Outer_Bottom}"/>

        <local:MappingConverter x:Key="A_Converter_FooterIconToVis"
                                Default="{x:Static Visibility.Collapsed}">
            <local:MappingConverterEntry Key="Locked" Value="{x:Static Visibility.Visible}" />
            <local:MappingConverterEntry Key="Pinned" Value="{x:Static Visibility.Visible}" />
        </local:MappingConverter>

        <Style x:Key="A_Style_FZMaterial_ChallengePinFooter"
               BasedOn="{StaticResource A_Style_FZMaterial_MapPinFooter}"
               TargetType="{x:Type local:FZMaterial}">
            <Setter Property="local:MultiDataConversion.Value" Value="{Binding SnapContext.Id, RelativeSource={RelativeSource AncestorType=Page}}" />
            <Setter Property="local:MultiDataConversion.Parameter" Value="{Binding PinnedChallenge.Id, RelativeSource={RelativeSource AncestorType=Page}}" />
            <Setter Property="local:MultiDataConversion.Converter" Value="{StaticResource A_CompareConverter}" />
            <Setter Property="local:MultiDataConversion.TargetType" Value="{x:Type Int32}" />
            <Setter Property="Color" Value="{Binding BrickChallengeType, Converter={StaticResource A_Converter_BrickChallengeTypeToColor}}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding (local:MultiDataConversion.Output), RelativeSource={RelativeSource Self}}" Value="{x:Static local:CompareResult.Equal}">
                    <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_PinBottom_Pinned}" />
                    <Setter Property="Color" Value="#FFFFFF" />
                    <Setter Property="Tag" Value="Pinned" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsLocked}" Value="True">
                    <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterBottomOnly}" />
                    <Setter Property="Color" Value="#969696" />
                    <Setter Property="Tag" Value="Locked" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsComplete}" Value="True">
                    <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_PinBottom_Complete}" />
                    <Setter Property="Color" Value="#FFFFFF" />
                    <Setter Property="Tag" Value="Complete" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <local:MappingConverter x:Key="A_Converter_ChallengeTypeToColorString"
                                Default="Blue">
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.Smashable}" Value="Orange" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.Collectable}" Value="Green" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.Skill}" Value="Yellow" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.Discovery}" Value="Purple" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.PRStunt}" Value="Red" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.Event}" Value="Blue" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_Converter_ChallengeTypeToString"
                                Default="{local:Loc Expansions.IDS_BrickChallengeType_Event}">
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.Smashable}" Value="{local:Loc Expansions.IDS_BrickChallengeType_Smashable}" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.Collectable}" Value="{local:Loc Expansions.IDS_BrickChallengeType_Collectable}" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.Skill}" Value="{local:Loc Expansions.IDS_BrickChallengeType_Skill}" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.Discovery}" Value="{local:Loc Expansions.IDS_BrickChallengeType_Discovery}" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.PRStunt}" Value="{local:Loc Expansions.IDS_BrickChallengeType_PRStunt}" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeType.Event}" Value="{local:Loc Expansions.IDS_BrickChallengeType_Event}" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_Converter_ChallengeDifficultyToString"
                                Default="{local:Loc Expansions.IDS_BrickChallengeDifficulty_Easy}">
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeDifficulty.Easy}" Value="{local:Loc Expansions.IDS_BrickChallengeDifficulty_Easy}" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeDifficulty.Medium}" Value="{local:Loc Expansions.IDS_BrickChallengeDifficulty_Medium}" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeDifficulty.Hard}" Value="{local:Loc Expansions.IDS_BrickChallengeDifficulty_Hard}" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeDifficulty.VeryHard}" Value="{local:Loc Expansions.IDS_BrickChallengeDifficulty_VeryHard}" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_Converter_DifficultyToBrickSizeString"
                                Default="2x1">
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeDifficulty.Easy}" Value="2x1" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeDifficulty.Medium}" Value="2x2" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeDifficulty.Hard}" Value="2x3" />
            <local:MappingConverterEntry Key="{x:Static local:BrickChallengeDifficulty.VeryHard}" Value="2x4" />
        </local:MappingConverter>
        <String x:Key="A_String_Format5">{0}{1}{2}{3}{4}</String>

        <local:MappingConverter x:Key="A_Converter_FooterStateIcon"
                                Default="">
            <local:MappingConverterEntry Key="Pinned" Value="/ForzaUI;component/Textures/Data_Bound/PDLC2/BrickChallenges/Pins/pin.png" />
            <local:MappingConverterEntry Key="Locked" Value="/ForzaUI;component/Textures/Data_Bound/PDLC2/BrickChallenges/Pins/padlock.png" />
        </local:MappingConverter>

        <local:MappingConverter x:Key="A_Converter_FooterStateString"
                                Default="">
            <local:MappingConverterEntry Key="Pinned" Value="{local:Loc Expansions.IDS_BrickChallenge_Pin_PinnedChallenge}" />
            <local:MappingConverterEntry Key="Locked" Value="{local:Loc Expansions.IDS_BrickChallenge_Pin_LockedChallenge}" />
        </local:MappingConverter>

        <local:MultiConverter x:Key="A_Converter_FooterStateStringToUpper">
            <local:MultiConverterEntry Converter="{StaticResource A_Converter_FooterStateString}" />
            <local:MultiConverterEntry Converter="{StaticResource A_StringToUpper}" />
        </local:MultiConverter>

        <Style x:Key="A_Style_FrameworkElement_CollapsedIfLocked" TargetType="FrameworkElement">
            <Setter Property="Visibility" Value="{x:Static Visibility.Visible}" />
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding IsLocked}" Value="True" />
                        <Condition Binding="{Binding IsComplete}" Value="False" />
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Visibility" Value="{x:Static Visibility.Collapsed}" />
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZRun_PinBrickChallengeTypeAndDifficulty_HIGHLIGHT"
               TargetType="local:FZRun">
            <Setter Property="FontFamily"
                Value="Horizon_A" />
        </Style>

        <DataTemplate DataType="{x:Type local:BrickChallengeDataSource}">
            <DataTemplate.Resources>
                <Style x:Key="A_Style_FZMaterial_MapPinInfoPillBackground_Dynamic" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_MapPinInfoPillBackground_Base}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsComplete}" Value="True">
                            <Setter Property="Tag" Value="Complete" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
                <Style x:Key="A_Style_FZMaterial_MainPinIcon"
                       TargetType="local:FZMaterial">
                    <Setter Property="local:MultiStringFormatter.Param1" Value="{Binding BrickChallengeType, Converter={StaticResource A_Converter_ChallengeTypeToColorString}}" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsLocked}" Value="True">
                            <Setter Property="local:MultiStringFormatter.Param1" Value="Locked" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding IsComplete}" Value="True">
                            <Setter Property="local:MultiStringFormatter.Param1" Value="Gold" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </DataTemplate.Resources>
            <Grid>
                <local:FZMaterial Opacity="0.6"
                                  Margin="-10"
                                  Color="#000000"
                                  Style="{StaticResource A_Style_FZMaterial_ShadowBase_ForSubgraph}">
                    <local:FZMaterial.Preset>
                        <local:FZMaterialPresetRoundtangle Softness="35" CornerRadius="20" AlphaMode="MultiplyInvColorOnly" Unlit="True" />
                    </local:FZMaterial.Preset>
                </local:FZMaterial>
                <StackPanel MinWidth="{StaticResource A_Double_MapPin_MinWidth}"
                            MaxWidth="{StaticResource A_Double_MapPin_MaxWidth}"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center">
                    <local:FZMaterial Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterTopOnly}"
                                      Color="#FFFFFF"
                                      Margin="0,0,0,-0.5">
                        <DockPanel>
                            <DockPanel DockPanel.Dock="Top"
                                       Margin="{StaticResource A_Thickness_MapPinMainContentMargin_TopAndSides}">
                                <Grid DockPanel.Dock="Left"
                                      Margin="0,0,0,0">
                                    <Decorator Margin="-15,0,-12,0">
                                        <local:FZMaterial local:MultiStringFormatter.Param0="{StaticResource A_String_BrickChallenges_PinIconLocation}"
                                                          local:MultiStringFormatter.Param2="_"
                                                          local:MultiStringFormatter.Param3="{Binding Difficulty, Converter={StaticResource A_Converter_DifficultyToBrickSizeString}}"
                                                          local:MultiStringFormatter.Param4=".png"
                                                          local:MultiStringFormatter.Format="{StaticResource A_String_Format5}"
                                                          Style="{StaticResource A_Style_FZMaterial_MainPinIcon}"
                                                          ImageSource="{Binding (local:MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"
                                                          Width="110"
                                                          Height="94" />
                                    </Decorator>
                                </Grid>
                                <Decorator Width="11" DockPanel.Dock="Left" />
                                <StackPanel VerticalAlignment="Center"
                                            HorizontalAlignment="Left">
                                    <local:AutoScrollPanel Style="{StaticResource A_Style_AutoScrollPanel_BrickChallengePinTitle}" />
                                    <Decorator Height="11" />
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_MapPin_DescriptionText}"
                                                       local:MultiStringFormatter.Param0="{Binding BrickChallengeType, Converter={StaticResource A_Converter_ChallengeTypeToString}}"
                                                       local:MultiStringFormatter.Param1="{Binding Difficulty, Converter={StaticResource A_Converter_ChallengeDifficultyToString}}"
                                                       local:MultiStringFormatter.Format="{local:Loc Expansions.IDS_BrickChallenge_TypeAndDifficulty}"
                                                       local:TextBlockInlineMarkup.Markup="{Binding (local:MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"
                                                       local:TextBlockInlineMarkup.ResourceBaseName="A_Style_FZRun_PinBrickChallengeTypeAndDifficulty_" />
                                    <Decorator Height="16" />
                                </StackPanel>
                            </DockPanel>
                            <DockPanel DockPanel.Dock="Bottom"
                                       Margin="{StaticResource A_Thickness_MapPinMainContentMargin_BottomAndSides}">
                                <local:FZTextBlock Text="{Binding Source={local:Loc Expansions.IDS_Reward}, Converter={StaticResource A_StringToUpper}}"
                                                   Style="{StaticResource A_Style_FZTextBlock_HorizonA}"
                                                   Color="{StaticResource A_Color_MapPinDescription}"
                                                   DockPanel.Dock="Left"
                                                   VerticalAlignment="Center"
                                                   CapHeight="20"
                                                   Margin="2,0,0,0" />
                                <local:FZTextBlock Text="{Binding Reward.Description}"
                                                   Style="{StaticResource A_Style_FZTextBlock_HorizonA}"
                                                   Color="{StaticResource A_Color_MapPinDescription}"
                                                   DockPanel.Dock="Right"
                                                   VerticalAlignment="Center"
                                                   CapHeight="20"
                                                   Margin="0,0,2,0" />
                                <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/PDLC2/BrickChallenges/Pins/RewardIcon.png"
                                                  Width="56"
                                                  Height="56"
                                                  DockPanel.Dock="Right"
                                                  VerticalAlignment="Center"
                                                  Margin="-12" />
                                <Decorator x:Name="SpaceFiller" />
                            </DockPanel>
                            <Grid Margin="{StaticResource A_Thickness_MapPinMainContentMargin_BottomAndSides}">
                                <StackPanel>
                                    <Control Template="{StaticResource A_ControlTemplate_MapPinInfoPill}">
                                        <Control.Resources>
                                            <Style x:Key="A_Style_FZMaterial_MapPinInfoPillIcon_Dynamic" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_MapPinInfoPillIcon_Base}">
                                                <Setter Property="Visibility" Value="Collapsed" />
                                            </Style>
                                            <Style x:Key="A_Style_FZTextBlock_MapPinInfoPillTitle_Dynamic" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_MapPinInfoPillTitle_Base}">
                                                <Setter Property="FontFamily" Value="Horizon_B" />
                                                <Setter Property="Margin" Value="12,0,0,0" />
                                                <Setter Property="local:TextBlockInlineMarkup.Markup" Value="{Binding Description}" />
                                                <Setter Property="local:TextBlockInlineMarkup.ResourceBaseName" Value="A_Style_FZRun_PinBrickChallengeDescription_" />
                                                <Setter Property="TextWrapping" Value="Wrap" />
                                                <Style.Triggers>
                                                    <MultiDataTrigger>
                                                        <MultiDataTrigger.Conditions>
                                                            <Condition Binding="{Binding IsLocked}" Value="True" />
                                                            <Condition Binding="{Binding IsComplete}" Value="False" />
                                                        </MultiDataTrigger.Conditions>
                                                        <Setter Property="local:TextBlockInlineMarkup.Markup" Value="{Binding LockedMessage}" />
                                                    </MultiDataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                            <Style x:Key="A_Style_AutoScrollPanel_MapPinInfoPillDescription_Dynamic" TargetType="local:AutoScrollPanel" BasedOn="{StaticResource A_Style_AutoScrollPanel_MapPinInfoPillDescription_Base}">
                                                <Setter Property="Visibility" Value="Collapsed" />
                                            </Style>
                                            <Style x:Key="A_Style_FZMaterial_MapPinInfoPillBackground_Dynamic" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_MapPinInfoPillBackground_Base}" />
                                        </Control.Resources>
                                    </Control>
                                    <Decorator Margin="0,12,0,0"
                                               Style="{StaticResource A_Style_FrameworkElement_CollapsedIfLocked}">
                                        <Grid>
                                            <local:FZMaterial x:Name="background" Style="{DynamicResource A_Style_FZMaterial_MapPinInfoPillBackground_Dynamic}" />
                                            <Grid>
                                                <Decorator>
                                                    <local:FZMaterial x:Name="MidasTouch"
                                                                      Style="{StaticResource A_Style_FZMaterial_MapPinInfoPillBackgroundStroke_Dynamic}" />
                                                </Decorator>
                                                <DockPanel Style="{DynamicResource A_Style_FZMaterial_MapPinInfoPillTextContainer_Dynamic}"
                                                           HorizontalAlignment="Stretch"
                                                           VerticalAlignment="Stretch">
                                                    <local:FZTextBlock Style="{DynamicResource A_Style_FZTextBlock_MapPinInfoPillTitle_Dynamic}"
                                                                       DockPanel.Dock="Left"
                                                                       Text="{Binding Source={local:Loc Expansions.IDS_Progress}, Converter={StaticResource A_StringToUpper}}"
                                                                       Margin="12,0,0,0" />
                                                    <local:Decorator Width="12"
                                                                     DockPanel.Dock="Left" />
                                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_MapPinInfoPillDescription_Dynamic}"
                                                                       Text="{Binding ProgressString, Converter={StaticResource A_StringToUpper}}"
                                                                       HorizontalAlignment="Right"
                                                                       DockPanel.Dock="Right"
                                                                       FontFamily="Horizon_A" />
                                                </DockPanel>
                                            </Grid>
                                        </Grid>
                                    </Decorator>
                                </StackPanel>
                            </Grid>
                        </DockPanel>
                    </local:FZMaterial>
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_ChallengePinFooter}">
                        <DockPanel Visibility="{Binding Tag, RelativeSource={RelativeSource AncestorType=local:FZMaterial}, Converter={StaticResource A_Converter_FooterIconToVis}}">
                            <local:FZTextBlock Text="{Binding Tag, RelativeSource={RelativeSource AncestorType=local:FZMaterial}, Converter={StaticResource A_Converter_FooterStateStringToUpper}}"
                                               Style="{StaticResource A_Style_FZTextBlock_HorizonA}"
                                               Color="#FFFFFF"
                                               Margin="18,12"
                                               CapHeight="15"
                                               DockPanel.Dock="Left"
                                               VerticalAlignment="Center" />
                            <local:FZMaterial ImageSourceNoPreload="{Binding Tag, RelativeSource={RelativeSource AncestorType=local:FZMaterial}, Converter={StaticResource A_Converter_FooterStateIcon}}"
                                              Width="44"
                                              Height="38"
                                              DockPanel.Dock="Right"
                                              HorizontalAlignment="Right"
                                              VerticalAlignment="Bottom"
                                              Margin="0,0,0,-2" />
                        </DockPanel>
                    </local:FZMaterial>
                </StackPanel>
            </Grid>
        </DataTemplate>

        <Style x:Key="A_Style_ControllerButtonControl_AButton"
               TargetType="{x:Type local:ControllerButtonControl}"
               BasedOn="{StaticResource A_Style_ControllerButtonControl_Default}">
            <Setter Property="local:MultiDataConversion.Value" Value="{Binding SnapContext.Id, RelativeSource={RelativeSource AncestorType=Page}}" />
            <Setter Property="local:MultiDataConversion.Parameter" Value="{Binding PinnedChallenge.Id, RelativeSource={RelativeSource AncestorType=Page}}" />
            <Setter Property="local:MultiDataConversion.Converter" Value="{StaticResource A_CompareConverter}" />
            <Setter Property="local:MultiDataConversion.TargetType" Value="{x:Type Int32}" />
            <Setter Property="Description" Value="{local:Loc Expansions.IDS_PinChallenge}" />
            <Setter Property="Tag" Value="{Binding PinHighlightedChallengeCommand, RelativeSource={RelativeSource AncestorType=Page}}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding SnapContext.HasRoute, RelativeSource={RelativeSource AncestorType=Page}}" Value="True">
                    <Setter Property="Description" Value="{local:Loc Expansions.IDS_PinChallengeAndSetRoute}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding (local:MultiDataConversion.Output), RelativeSource={RelativeSource Self}}" Value="{x:Static local:CompareResult.Equal}">
                    <Setter Property="Description" Value="{local:Loc Expansions.IDS_UnpinChallenge}" />
                    <Setter Property="Tag" Value="{Binding ClearPinnedChallengeCommand, RelativeSource={RelativeSource AncestorType=Page}}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding SnapContext, RelativeSource={RelativeSource AncestorType=Page}}" Value="{x:Null}">
                    <Setter Property="Description" Value="" />
                    <Setter Property="Tag" Value="{x:Null}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding SnapContext.IsComplete, RelativeSource={RelativeSource AncestorType=Page}}" Value="True">
                    <Setter Property="Description" Value="" />
                    <Setter Property="Tag" Value="{x:Null}" />
                </DataTrigger>
                <DataTrigger Binding="{Binding SnapContext.IsLocked, RelativeSource={RelativeSource AncestorType=Page}}" Value="True">
                    <Setter Property="Description" Value="" />
                    <Setter Property="Tag" Value="{x:Null}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_ControllerButtonControl_YButton"
               TargetType="{x:Type local:ControllerButtonControl}"
               BasedOn="{StaticResource A_Style_ControllerButtonControl_Default}">
            <Setter Property="Description" Value="{local:Loc Expansions.IDS_UnpinChallenge}" />
            <Setter Property="Tag" Value="{Binding ClearPinnedChallengeCommand, RelativeSource={RelativeSource AncestorType=Page}}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding PinnedChallenge, RelativeSource={RelativeSource AncestorType=Page}}" Value="{x:Null}">
                    <Setter Property="Description" Value="" />
                    <Setter Property="Tag" Value="{x:Null}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_ControllerButtonControl_StartButton"
               TargetType="{x:Type local:ControllerButtonControl}"
               BasedOn="{StaticResource A_Style_ControllerButtonControl_Default}">
            <Setter Property="Description" Value="{local:Loc HelpButtons.IDS_ForzaVista_Drive}" />
            <Setter Property="Tag" Value="{Binding ExitToFreeroamCommand, RelativeSource={RelativeSource AncestorType=Page}}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding ExitToFreeroamCommand, RelativeSource={RelativeSource AncestorType=Page}}" Value="{x:Null}">
                    <Setter Property="Description" Value="" />
                    <Setter Property="Tag" Value="{x:Null}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_ChallengeCount"
               BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}"
               TargetType="{x:Type local:FZTextBlock}">
            <Setter Property="Color" Value="{StaticResource A_Color_Tile_Text}" />
            <Setter Property="CapHeight" Value="18" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>

        <local:UIStoryboard x:Key="A_Storyboard_BrickChallenges_Pinned">
            <local:UIStoryboard.TriggerAnimation>
                <local:StartAudioTrigger local:TriggerAnimation.KeyTime="0:0:0.0" EventName="AudioUITrigger_Red_Challenge_Pin"/>
            </local:UIStoryboard.TriggerAnimation>
        </local:UIStoryboard>

        <local:UIStoryboard x:Key="A_Storyboard_BrickChallenges_Unpinned">
            <local:UIStoryboard.TriggerAnimation>
                <local:StartAudioTrigger local:TriggerAnimation.KeyTime="0:0:0.0" EventName="AudioUITrigger_Red_Challenge_Unpin"/>
            </local:UIStoryboard.TriggerAnimation>
        </local:UIStoryboard>

        <local:MultiConverter x:Key="A_Converter_VignetteBottom">
            <local:MultiConverterEntry>
                <local:MultiConverterEntry.Converter>
                    <local:LinearTransformConverter Add="-187" />
                </local:MultiConverterEntry.Converter>
            </local:MultiConverterEntry>
        </local:MultiConverter>

        <local:MultiConverter x:Key="A_Converter_VignetteVerticalSizeToOffset">
            <local:MultiConverterEntry>
                <local:MultiConverterEntry.Converter>
                    <local:LinearTransformConverter Add="-87" />
                </local:MultiConverterEntry.Converter>
            </local:MultiConverterEntry>
        </local:MultiConverter>
        <local:MultiConverter x:Key="A_Converter_VignetteVerticalSizeToNegOffset">
            <local:MultiConverterEntry>
                <local:MultiConverterEntry.Converter>
                    <local:LinearTransformConverter Scale="-1" />
                </local:MultiConverterEntry.Converter>
            </local:MultiConverterEntry>
            <local:MultiConverterEntry>
                <local:MultiConverterEntry.Converter>
                    <local:LinearTransformConverter Add="87" />
                </local:MultiConverterEntry.Converter>
            </local:MultiConverterEntry>
        </local:MultiConverter>

        <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_Vignette_BrickChallenges"
                                       Softness="250"
                                       Reflectivity="0"
                                       SpecularBrightness="0"
                                       SpecularPower="0" />

        <Style x:Key="A_Style_FZMaterial_VignetteShadow"
               TargetType="{x:Type local:FZMaterial}">
            <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
            <Setter Property="Color" Value="#FF03003B" />
            <Setter Property="Opacity" Value="1.25" />
            <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_Vignette_BrickChallenges}" />
            <Setter Property="IsHitTestVisible" Value="False" />
            <Setter Property="Margin" Value="-250,0,-250,0" />
        </Style>
    </Page.Resources>

    <local:EventFire.FzTriggers>
        <local:EventFireTrigger Event="ChallengePinned" Storyboard="{StaticResource A_Storyboard_BrickChallenges_Pinned}"/>
        <local:EventFireTrigger Event="ChallengeUnpinned" Storyboard="{StaticResource A_Storyboard_BrickChallenges_Unpinned}"/>
    </local:EventFire.FzTriggers>

    <Grid>
        <local:FZMaterial Color="#FF9ABDDB" />
        <local:RoutedEventCommand x:Name="MouseUpRoutedEventCommand" RoutedEvent="Mouse.MouseUp"
                                  Command="{Binding OnMouseUp}" />
        <local:RoutedEventCommand x:Name="MouseLeftButtonDownRoutedEventCommand" RoutedEvent="UIElement.MouseLeftButtonDown"
                                  Command="{Binding OnLeftMouseDown}" />

        <local:MapViewControllerInteractive x:Name="PART_ViewController"
                                            Style="{StaticResource A_Style_MapViewControllerInteractive_DefaultController}"
                                            MapId="{Binding MapId, ElementName=PART_MapCustomRenderElement}" />

        <Canvas x:Name="LayoutRoot">
            <local:MapCustomRenderElement MapId="brick_challenges"
                                          MapProfile="brick_challenges"
                                          Height="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=Page}}"
                                          Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=Page}}"
                                          MapView="{Binding ElementName=PART_ViewController}"
                                          x:Name="PART_MapCustomRenderElement" />
            <local:FZMaterialGlassCapture />
        </Canvas>

        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
              HorizontalAlignment="Stretch"
              VerticalAlignment="Stretch"
              Width="Auto"
              Height="Auto">
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_VignetteShadow}"
                              Color="#FF000000"
                              Opacity="0.5">
                <local:FZMaterial.RenderTransform>
                    <TranslateTransform Y="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=local:FZMaterial}, Converter={StaticResource A_Converter_VignetteBottom}}" />
                </local:FZMaterial.RenderTransform>
            </local:FZMaterial>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_VignetteShadow}">
                <local:FZMaterial.RenderTransform>
                    <TranslateTransform Y="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=local:FZMaterial}, Converter={StaticResource A_Converter_VignetteVerticalSizeToOffset}}" />
                </local:FZMaterial.RenderTransform>
            </local:FZMaterial>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_VignetteShadow}">
                <local:FZMaterial.RenderTransform>
                    <TranslateTransform Y="{Binding ActualHeight, RelativeSource={RelativeSource AncestorType=local:FZMaterial}, Converter={StaticResource A_Converter_VignetteVerticalSizeToNegOffset}}" />
                </local:FZMaterial.RenderTransform>
            </local:FZMaterial>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_VignetteShadow}"
                              Margin="0,-250,0,-250">
                <local:FZMaterial.RenderTransform>
                    <TranslateTransform X="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=local:FZMaterial}, Converter={StaticResource A_Converter_VignetteVerticalSizeToOffset}}" />
                </local:FZMaterial.RenderTransform>
            </local:FZMaterial>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_VignetteShadow}"
                              Margin="0,-250,0,-250">
                <local:FZMaterial.RenderTransform>
                    <TranslateTransform X="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=local:FZMaterial}, Converter={StaticResource A_Converter_VignetteVerticalSizeToNegOffset}}" />
                </local:FZMaterial.RenderTransform>
            </local:FZMaterial>
        </Grid>

        <local:RoutedEventCommand x:Name="ButtonBarDisableMouseCursorMovement"
                                  RoutedEvent="UIElement.MouseEnter"
                                  Command="{Binding DisableMouseCursorMovement}" />
        <local:RoutedEventCommand x:Name="ButtonBarEnableMouseCursorMovement"
                                  RoutedEvent="UIElement.MouseLeave"
                                  Command="{Binding EnableMouseCursorMovement}" />

        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
              VerticalAlignment="Top">
            <Decorator Margin="{StaticResource A_Thickness_Margin_PlayerBar}">
                <Grid>
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_ObjectiveBacking}"
                                        Margin="0,52,6,0"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Top"
                                        Visibility="{Binding ObjectiveText, Converter={StaticResource A_StringVisConverter}, FallbackValue=Collapsed}">
                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_PlayerBarBold}"
                                           Margin="{StaticResource A_Margin_PlayerBarText}"
                                           local:TextBlockInlineMarkup.Markup="{Binding ObjectiveText}" 
                                           local:TextBlockInlineMarkup.ResourceBaseName="A_Style_FZRun_MapFestivalInstruction_"
                                           Effect="{StaticResource A_DropShadowEffect_HelpBar}"/>
                    </local:FZMaterial>
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_InstructionBacking}"
                                      Visibility="{Binding InstructionText, Converter={StaticResource A_StringVisConverter}, FallbackValue={x:Static Visibility.Collapsed}}"
                                      HorizontalAlignment="Left"
                                      VerticalAlignment="Top">
                        <StackPanel Orientation="Horizontal">
                            <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Anthem/HUD/InfoIconSmall.png"
                                            Width="32"
                                            Height="32" Margin="5,0,0,0"/>
                            <local:FZTextBlock Text="{Binding InstructionText}"
                                               Style="{StaticResource A_Style_FZTextBlock_PlayerBarBold}"
                                               VerticalAlignment="Center"
                                               Margin="10,0"/>
                        </StackPanel>
                    </local:FZMaterial>
                </Grid>
            </Decorator>
            <!-- Debug Only -->
            <local:FZMaterial Color="#80000000"
                              Visibility="{Binding SelectionFilters, Converter={StaticResource A_StringVisConverter}, FallbackValue=Collapsed}"
                              VerticalAlignment="Center"
                              HorizontalAlignment="Right">
                <local:FZTextBlock Text="{Binding SelectionFilters}"
                                   FontSize="24"
                                   Color="#FFFFFFFF"
                                   FontFamily="Horizon_B"
                                   Margin="20" />
            </local:FZMaterial>
        </Grid>

        <Border Style="{StaticResource A_Style_Border_ScenePadding}">
            <Grid HorizontalAlignment="Right"
                  VerticalAlignment="Top"
                  Margin="0,14,6,0"
                  Visibility="{Binding NextUnlockMessage, Converter={StaticResource A_StringVisConverter}}">
                <Control Style="{StaticResource A_Style_Control_BrickChallengeObjective}" />
            </Grid>
        </Border>

        <Canvas DataContext="{Binding MapView, ElementName=PART_MapCustomRenderElement}">
            <Grid x:Name="PinContainer"
                  Style="{StaticResource A_Style_PinContainer}">
                <ContentControl Content="{Binding SnapContext, RelativeSource={RelativeSource FindAncestor, AncestorType=Page}}"
                                Style="{StaticResource A_Style_ContentControl_MapPin}"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                IsHitTestVisible="False"
                                local:AttachedRoutedEventCommand.Command="{Binding OnPinSizeChangedCommand, RelativeSource={RelativeSource AncestorType=Page}}"
                                local:AttachedRoutedEventCommand.RoutedEvent="FrameworkElement.SizeChanged"
                                x:Name="Pin">
                    <ContentControl.Template>
                        <ControlTemplate TargetType="ContentControl">
                            <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
                                       Height="Auto"
                                       Width="Auto"
                                       HorizontalAlignment="Stretch"
                                       VerticalAlignment="Stretch">
                                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_MapFloatingPanelShadow}" />
                                <ContentPresenter />
                            </Grid>
                        </ControlTemplate>
                    </ContentControl.Template>
                </ContentControl>
            </Grid>
        </Canvas>

        <local:FZMaterial x:Name="MouseClickHelperMaterial"
                          GreedyMeasure="True"
                          Color="#00FFFFFF"
                          local:RoutedEventCommand.Action="{Binding ElementName=MouseUpRoutedEventCommand}"
                          local:RoutedEventCommand.Action2="{Binding ElementName=MouseLeftButtonDownRoutedEventCommand}" />

        <local:RoutedEventCommand x:Name="MapZoomInRoutedEventCommand"
                                  RoutedEvent="UIElement.MouseLeftButtonDown"
                                  Command="{Binding MapZoomInCommand}" />
        <local:RoutedEventCommand x:Name="MapZoomOutRoutedEventCommand"
                                  RoutedEvent="UIElement.MouseLeftButtonDown"
                                  Command="{Binding MapZoomOutCommand}" />
        <local:RoutedEventCommand x:Name="UpMapZoomStopRoutedEventCommand"
                                  RoutedEvent="UIElement.MouseLeftButtonUp"
                                  Command="{Binding MapStopZoomCommand}" />
        <local:RoutedEventCommand x:Name="LeaveMapZoomStopRoutedEventCommand"
                                  RoutedEvent="UIElement.MouseLeave"
                                  Command="{Binding MapStopZoomCommand}" />

        <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                        Template="{StaticResource A_ControlTemplate_ButtonBar_Map}"
                        x:Name="BottomBar">
            <local:FZMaterial x:Name="MouseButtonBarHitHelper"
                              Height="30"
                              Width="Auto"
                              local:RoutedEventCommand.Action="{Binding ElementName=ButtonBarDisableMouseCursorMovement}"
                              local:RoutedEventCommand.Action2="{Binding ElementName=ButtonBarEnableMouseCursorMovement}"
                              Color="#00000000">
                <local:ControllerButtonPanel x:Name="HelpPanel"
                                             Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
                    <local:ControllerButtonControl Button="A"
                                                   Style="{StaticResource A_Style_ControllerButtonControl_AButton}"
                                                   AllowMouseClick="False"
                                                   x:Name="AButtonControl" />
                    <local:ControllerButtonControl Button="B"
                                                   Description="{local:Loc HelpButtons.IDS_Back}"
                                                   Visibility="{Binding CanExit, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
                    <local:ControllerButtonControl Button="Y"
                                                   Style="{StaticResource A_Style_ControllerButtonControl_YButton}"
                                                   x:Name="YButtonControl" />
                    <local:ControllerButtonControl Button="Start"
                                                   Style="{StaticResource A_Style_ControllerButtonControl_StartButton}"
                                                   x:Name="StartButtonControl" />
                    <local:ControllerButtonControl Button="RThumb_Up"
                                                   InputOverride="{local:Input Command=INPUTCMD_UI_RIGHT_STICK_UP, Context=INPUTCONTEXT_UI}"
                                                   Visibility="{Binding ShowMouseZoomButtons, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}"
                                                   Description="{local:Loc HelpButtons.IDS_MapZoomIn}" />
                    <local:ControllerButtonControl Button="RThumb_Down"
                                                   InputOverride="{local:Input Command=INPUTCMD_UI_RIGHT_STICK_DOWN, Context=INPUTCONTEXT_UI}"
                                                   Visibility="{Binding ShowMouseZoomButtons, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}"
                                                   Description="{local:Loc HelpButtons.IDS_MapZoomOut}" />
                </local:ControllerButtonPanel>
            </local:FZMaterial>
        </ContentControl>
        <local:PageInputHandler Button="{x:Static local:ControllerButtonType.A}"
                                Command="{Binding Tag, ElementName=AButtonControl}" />
        <local:PageInputHandler Button="{x:Static local:ControllerButtonType.Y}"
                                Command="{Binding Tag, ElementName=YButtonControl}" />
        <local:PageInputHandler Button="{x:Static local:ControllerButtonType.Start}"
                                Command="{Binding Tag, ElementName=StartButtonControl}" />
    </Grid>
</Page>
