<!-- Resource Dictionary used to store a Data Template used to 
     display application content icon and brief details.
     This data template will be selected by the MessageContentSelector class if the message 
     content is determined to be of Application type.
     Code behind to process control events are in MessageContentImageDataTemplate.cs 
     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.MessageContentApplicationDataTemplate"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:commonconverters="using:was.touchcopy.features.converters"
    xmlns:converters="using:was.touchcopy.features.messaging.converters">

    <commonconverters:ValueToVisibilityConverter x:Key="ValueToVisibilityConverter"/>
    <converters:MessageContentToApplicationConverter x:Key="MessageContentToApplicationConverter"/>
    
    <DataTemplate x:Key="MessageContentApplicationDataTemplate" >
        <Grid Margin="-10,0" RowSpacing="12">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Image x:Name="imageIcon" Margin="0,0,5,0" VerticalAlignment="Top"
                   Tag="{Binding Converter={StaticResource MessageContentToApplicationConverter}}" 
                   Source="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Tag.Icon}"/>
            <StackPanel Grid.Column="1" VerticalAlignment="Center" >
                <TextBlock Text="{Binding ElementName=imageIcon, Path=Tag.FileName}" FontWeight="Bold" />
                <TextBlock Text="{Binding ElementName=imageIcon, Path=Tag.FormattedFileSize}" Visibility="{Binding ElementName=imageIcon, Path=Tag.IsAvailable, Converter={StaticResource ValueToVisibilityConverter}}"/>
                <TextBlock x:Uid="TextBlockFileNotDownloadedOnDevice" Text="XX File not downloaded on device." Visibility="{Binding ElementName=imageIcon, Path=Tag.IsAvailable, Converter={StaticResource ValueToVisibilityConverter}, ConverterParameter='invert'}" Padding="0,0,5,0" />
            </StackPanel>
            <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Spacing="12" Visibility="{Binding ElementName=imageIcon, Path=Tag.IsAvailable, Converter={StaticResource ValueToVisibilityConverter}}">
                <Button x:Uid="ButtonOpenFile" Content="XX Open File" Margin="0,0,0,0" Click="ButtonOpenFileClicked" Tag="{Binding}"/>
                <Button x:Uid="ButtonSaveToPC" Content="XX Save to PC" Margin="0,0,0,0" Click="ButtonSaveFileClicked" Tag="{Binding}"/>
            </StackPanel>
            
        </Grid>
    </DataTemplate>
</ResourceDictionary>
