<Window x:Class="WintellogWpf.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        mc:Ignorable="d"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Data="clr-namespace:PortableWintellog.Data;assembly=PortableWintellog" Title="MainWindow" Height="768" Width="1024">
    <Grid Background="White">
        <Grid.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="FontFamily" Value="Segoe UI"/>
            </Style>
        </Grid.Resources>
        <Grid HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="Splash">
            <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
                <Image Source="Assets/SplashScreen.png" HorizontalAlignment="Center"
                       VerticalAlignment="Top" Stretch="None"/>
                <TextBlock 
                    x:Name="Status"
                    Text="Initializing..." 
                           HorizontalAlignment="Center"
                           FontFamily="Segoe UI"
                           FontSize="24"/>
            </StackPanel>
        </Grid>
        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="12" x:Name="Groups"
              d:DataContext="{d:DesignInstance Type=Data:BlogDataSource, IsDesignTimeCreatable=True}">
            <ListView x:Name="BlogList" ItemsSource="{Binding GroupList}"
                      VerticalContentAlignment="Top">
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <VirtualizingStackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
                <ListView.Template>
                    <ControlTemplate TargetType="ListView">
                        <Border>
                            <ScrollViewer>
                                <ItemsPresenter/>
                            </ScrollViewer>
                        </Border>
                    </ControlTemplate>
                </ListView.Template>
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <Grid Width="400">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <TextBlock Text="{Binding Title}" FontSize="36" 
                                       Width="325"
                                       HorizontalAlignment="Left"
                                       TextWrapping="Wrap"/>
                            <ListBox Grid.Row="1" ItemsSource="{Binding Items}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid Width="350" Margin="6">
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto"/>
                                                <RowDefinition Height="*"/>
                                                <RowDefinition Height="Auto"/>
                                            </Grid.RowDefinitions>
                                            <TextBlock Text="{Binding Title}" FontSize="24"
                                                       TextWrapping="Wrap"/>
                                            <Image Source="{Binding DefaultImageUri}"
                                                   Height="150"
                                                   Width="150"
                                                   HorizontalAlignment="Right"
                                                   Stretch="UniformToFill"
                                                   Grid.Row="1" Grid.RowSpan="2"
                                                   Opacity="0.2" Margin="6"/>
                                            <TextBlock Text="{Binding Description}" 
                                                       Height="75"
                                                       Grid.Row="1"                                                       
                                                       TextWrapping="Wrap"/>
                                            <Button Content="Read Full Item" Grid.Row="2"
                                                    Margin="6" Click="Button_Click_1"/>                                            
                                        </Grid>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </Grid>
    </Grid>
</Window>
