<!-- Resource Dictionary used to store a Data Template used to 
     display a Contact within message content.
     This data template will be selected by the MessageContentSelector class if 
     the message content is determined to be of Contact type. 
     You should include a static reference to MessageContentApplicationDataTemplate on the page where you plan to use
     the DataTemplate MessageContentApplicationDataTemplate.xaml -->
<ResourceDictionary
    x:Class="was.touchcopy.features.messaging.ux.MessageContentContactDataTemplate"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:messaging="using:was.touchcopy.features.messaging"
    xmlns:converters="using:was.touchcopy.features.messaging.converters"
    xmlns:commonconverters="using:was.touchcopy.features.converters">

    <converters:MessageContentAvailabilityToVisibilityConverter x:Key="MessageContentAvailabilityToVisibilityConverter" />
    <commonconverters:VisibilityInverter x:Key="VisibilityInverter" />

    <DataTemplate x:Key="MessageContentContactDataTemplate" x:DataType="messaging:MessageContent">
        <Grid>
            <Grid x:Name="gridContactsContent" Margin="0,5" DataContextChanged="_gridContactsContent_DataContextChanged" Visibility="{Binding Converter={StaticResource MessageContentAvailabilityToVisibilityConverter}, Mode=OneTime}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <FontIcon x:Name="fontIcon" Glyph="&#xEA8C;" FontSize="32" VerticalAlignment="Top" Margin="0,0,20,0" Foreground="{ThemeResource SystemColorButtonFaceColor}" />
                <Border x:Name="borderContactImage" VerticalAlignment="Top" Margin="0,0,20,0" CornerRadius="20" Visibility="Collapsed" Background="{ThemeResource AppBarBackgroundThemeBrush}" Width="40" Height="40">
                    <TextBlock x:Name="textBlockInitials" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="SemiBold" FontSize="16" IsTextScaleFactorEnabled="True" MaxWidth="40" />
                </Border>
                <StackPanel x:Name="stackPanelDetail" Grid.Column="1">
                    <TextBlock x:Uid="TextBlockLoadingContact" x:Name="textBlockTitle" Text="XX Loading Contact..." FontStyle="Italic" />
                    <TextBlock x:Name="textBlockDetail" Margin="0,5,0,5"/>
                    <Button x:Name="buttonOpenContact" Content="Open Contact" Click="_buttonOpenContactClicked" IsEnabled="False"/>
                </StackPanel>
            </Grid>
            <Grid Visibility="{Binding Visibility, ElementName=gridContactsContent, Converter={StaticResource VisibilityInverter}, Mode=OneWay}" ColumnSpacing="12">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <StackPanel VerticalAlignment="Center">
                    <TextBlock x:Uid="TextBlockContactUnavailable" Text="XX Contact unavailable." Style="{ThemeResource BodyStrongTextBlockStyle}"/>
                    <TextBlock x:Uid="TextBlockAttachmentNotStoredOnDevice" Text="XX It may not be stored on your device." Style="{ThemeResource CaptionTextBlockStyle}"/>
                </StackPanel>
                <HyperlinkButton x:Uid="HyperlinkButtonAttachmentUnavailable" VerticalAlignment="Center" Grid.Column="1" CornerRadius="16" Padding="4">
                    <FontIcon Glyph="&#xE897;" />
                </HyperlinkButton>
            </Grid>
        </Grid>
    </DataTemplate>
</ResourceDictionary>
