<!-- Resource Dictionary used to store a Data Template used to 
     display location link content.
     This data template will be selected by the MessageContentSelector class if the message 
     content is determined to be of Location type. -->
    <ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:converters="using:was.touchcopy.features.messaging.converters"
    xmlns:commonconverters="using:was.touchcopy.features.converters">

    <converters:MessageContentToLocationUriConverter x:Key="MessageContentToLocationUriConverter"/>
    <converters:MessageContentAvailabilityToVisibilityConverter x:Key="MessageContentAvailabilityToVisibilityConverter" />
    <commonconverters:VisibilityInverter x:Key="VisibilityInverter" />
        
    <DataTemplate x:Key="MessageContentLocationDataTemplate">
        <Grid>
            <Grid x:Name="GridContactsContent" Margin="0,5" Visibility="{Binding Converter={StaticResource MessageContentAvailabilityToVisibilityConverter}, Mode=OneTime}" >
                <StackPanel>
                    <Grid Margin="0,0,0,5">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock x:Uid="textBlockLocationShared" Text="Location Shared" FontWeight="Bold" VerticalAlignment="Center"/>
                        <HyperlinkButton  Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" x:Uid="buttonShowMessageLocation" x:Name="buttonShowMessageLocation" 
                             Background="Transparent" BorderBrush="Transparent" 
                        NavigateUri="{Binding ElementName=buttonShowMessageLocation, Path=Tag}"
                        Tag="{Binding ContentLocation, Converter={StaticResource MessageContentToLocationUriConverter}}" >
                            <HyperlinkButton.Content>
                                <FontIcon Glyph="&#xE8A7;"/>
                            </HyperlinkButton.Content>
                        </HyperlinkButton>
                    </Grid>

                    <WebView2 Source="{Binding ElementName=buttonShowMessageLocation, Path=Tag}"
                          IsRightTapEnabled="False"
                          Height="430" Width="500" />
                </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="TextBlockLocationUnavailable" Text="XX Location 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>
