<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="GeoDashboard.SexTile" Width="254" Height="177" Margin="6" Foreground="White" FontFamily="Segoe UI" FontSize="24" FontWeight="Light" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:GeoDashboard">
  <Grid x:Name="LayoutRoot" Background="Black" DataContext="{Binding Path=Sources[USA_Population_by_Sex]}">

    <Grid.Resources>
      <local:ScaleConverter x:Key="_scaleConverter" />
    </Grid.Resources>

    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition />
    </Grid.RowDefinitions>

    <Border Style="{StaticResource _tileCaption}">
      <TextBlock Text="Population by Sex" FontSize="12" Foreground="Black" />
    </Border>

    <StackPanel Margin="12" Grid.Row="1">
      <StackPanel Orientation="Horizontal">
        <TextBlock Text="{Binding Dictionary[TOTPOP_CY].Value, StringFormat=n0}" FontWeight="Bold" Foreground="{StaticResource _brResult}" />
        <TextBlock Text=" people" />
      </StackPanel>

      <Grid Margin="10">
        <TextBlock Text="" FontFamily="Webdings" FontSize="80" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Blue" Opacity=".5" RenderTransformOrigin=".5 1">
          <TextBlock.RenderTransform>
            <ScaleTransform ScaleY="{Binding Dictionary[PMALE_CY].Value, Converter={StaticResource _scaleConverter}}" />
          </TextBlock.RenderTransform>
        </TextBlock>
        <TextBlock Text="{Binding Dictionary[PMALE_CY].Value, StringFormat=' {0}%'}" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Bottom" />

        <TextBlock Text="" FontFamily="WebDings" FontSize="80" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="Red" Opacity=".5" RenderTransformOrigin=".5 1">
          <TextBlock.RenderTransform>
            <ScaleTransform ScaleY="{Binding Dictionary[PFEMALE_CY].Value, Converter={StaticResource _scaleConverter}}" />
          </TextBlock.RenderTransform>
        </TextBlock>
        <TextBlock Text="{Binding Dictionary[PFEMALE_CY].Value, StringFormat=' {0}%'}" FontWeight="Bold" HorizontalAlignment="Right" VerticalAlignment="Bottom" />
      </Grid>
    </StackPanel>
  </Grid>
</UserControl>