<Page xmlns:TileView="using:C1.Xaml.TileView"  xmlns:Tile="using:C1.Xaml.Tile" 
    x:Class="FlexReportExplorer.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FlexReportExplorer"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:c1="using:C1.Xaml"
    xmlns:src="using:FlexReportExplorer"    
    xmlns:fv="using:C1.Xaml.FlexViewer" 
    mc:Ignorable="d"
    d:DataContext="{d:DesignData Source=Assets/ReportsDetail.xml}">


    <Page.Resources>

        <!-- The Template and Style selectors will look for the data templates and styles
              in their local resource collection -->
        <src:CustomTemplateSelector x:Key="TemplateSelector">
            <src:CustomTemplateSelector.Resources>
                <ResourceDictionary>
                    <c1:C1HierarchicalDataTemplate x:Key="CategoryTemplate" ItemsSource="{Binding Reports}">
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Height="50">
                                <Image Source="{Binding ImageUri}" Width="24" Height="24" Margin="3,3,3,3" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                <TextBlock Text="{Binding Text}" FontSize="14" FontFamily="Calibri" Foreground="Gray" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,0,0"/>
                            </StackPanel>
                        </DataTemplate>
                    </c1:C1HierarchicalDataTemplate>
                    <c1:C1HierarchicalDataTemplate x:Key="CategorySeperatorTemplate" ItemsSource="{Binding Reports}">
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Height="5">
                                <Image Source="Assets/Seperator.png" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center" Width="230"/>
                            </StackPanel>
                        </DataTemplate>
                    </c1:C1HierarchicalDataTemplate>
                    <c1:C1HierarchicalDataTemplate x:Key="ReportTemplate">
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{Binding ImageUri}" Width="100" Height="100" Margin="3,3,0,3" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                <TextBlock Text="{Binding ReportTitle}" FontSize="14" FontFamily="Calibri" Foreground="Gray" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0,0,0,0"/>
                            </StackPanel>
                        </DataTemplate>
                    </c1:C1HierarchicalDataTemplate>
                </ResourceDictionary>
            </src:CustomTemplateSelector.Resources>
        </src:CustomTemplateSelector>
        <src:CustomStyleSelector x:Key="TemplateStyleSelector">
            <src:CustomStyleSelector.Resources>
                <ResourceDictionary>
                    <Style x:Key="ExpandedStyle" TargetType="c1:C1TreeViewItem">
                        <Setter Property="IsExpanded" Value="False" />
                        <Setter Property="SelectedBackground" Value="#bfc9d7"/>
                    </Style>
                </ResourceDictionary>
            </src:CustomStyleSelector.Resources>
        </src:CustomStyleSelector>
    </Page.Resources>

    <Grid x:Name="LayoutRoot" >
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="270"/>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <ScrollViewer Style="{StaticResource ScrlVMainStyle}">
            <c1:C1TreeView x:Name="ReflectionTreeView"
                       ItemTemplateSelector="{StaticResource TemplateSelector}"
                       ItemContainerStyleSelector="{StaticResource TemplateStyleSelector}"
                       ItemsSource="{Binding}"
                       ItemClick="ReflectionTreeView_ItemClick">
            </c1:C1TreeView>
        </ScrollViewer>

        <fv:C1FlexViewerPane x:Name="flexViewerPane" Grid.Column="1" Style="{StaticResource FlexViewerPaneStyle}"/>
        <ProgressRing x:Name="prViewer" Grid.Column="1" Width="60" Height="60"/>

    </Grid>

</Page>
