<Page
    x:Class="BasicLibrarySamples.BindingToC1CollectionView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BasicLibrarySamples"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <ScrollViewer x:Name="scrollViewer"> 
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="300"/>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition />
                </Grid.RowDefinitions>

                <!-- ListBox -->
                <TextBlock Text="{Binding BindingToC1CollectionView_TB_1_Text,Source={StaticResource BasicLibrarySamplesLocalization}}"  FontSize="18" Padding="0 5 5 5"/>
                <ListBox Name="listBox1" Grid.Row="1" Background="Transparent" BorderThickness="0">
                    <ListBox.GroupStyle>
                        <GroupStyle>
                            <GroupStyle.HeaderTemplate>
                                <DataTemplate>
                                    <Border MinHeight="20" MinWidth="70" 
                                        Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush }" Padding="5">
                                        <TextBlock Text="{Binding}" Foreground="White" />
                                    </Border>
                                </DataTemplate>
                            </GroupStyle.HeaderTemplate>
                        </GroupStyle>
                    </ListBox.GroupStyle>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Border>
                                <StackPanel Orientation="Horizontal">
                                    <CheckBox IsChecked="{Binding Active}" MinWidth="32" Width="32" VerticalAlignment="Center"/>
                                    <TextBlock VerticalAlignment="Center">
                                        <Run Text="{Binding Name}"/>
                                        <Run Text=" "/>
                                        <Run Text="{Binding BindingToC1CollectionView_From_Text,Source={StaticResource BasicLibrarySamplesLocalization}}" />
                                        <Run Text=" "/>
                                        <Run Text="{Binding Country}"/>
                                    </TextBlock>
                                </StackPanel>
                            </Border>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>

                <!-- GridView -->
                <TextBlock Text="{Binding BindingToC1CollectionView_TB_2_Text,Source={StaticResource BasicLibrarySamplesLocalization}}" Grid.Column="1" FontSize="18" Padding="10 5 5 5"/>
                <GridView Name="gridView1" Grid.Row="1" Grid.Column="1" Margin="10,0,0,0">
                    <GridView.GroupStyle>
                        <GroupStyle>
                            <GroupStyle.HeaderTemplate>
                                <DataTemplate>
                                    <Border MinHeight="20" MinWidth="70" Background="#FF959595" Padding="5">
                                        <TextBlock Text="{Binding}" Foreground="White" VerticalAlignment="Center"/>
                                    </Border>
                                </DataTemplate>
                            </GroupStyle.HeaderTemplate>
                            <GroupStyle.Panel>
                                <ItemsPanelTemplate>
                                    <VariableSizedWrapGrid Orientation="Vertical" Height="400" />
                                </ItemsPanelTemplate>
                            </GroupStyle.Panel>
                        </GroupStyle>
                    </GridView.GroupStyle>

                    <GridView.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Width="200">
                                <CheckBox IsChecked="{Binding Active}" MinWidth="32" Width="32" VerticalAlignment="Center"/>
                                <TextBlock VerticalAlignment="Center">
                                        <Run Text="{Binding Name}"/>
                                        <Run Text=", "/>
                                        <Run Text="{Binding Country}"/>
                                </TextBlock>
                            </StackPanel>
                        </DataTemplate>
                    </GridView.ItemTemplate>
                </GridView>
            </Grid>
        </ScrollViewer>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="WideLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="540"/>
                    </VisualState.StateTriggers>
                </VisualState>
                <VisualState x:Name="NarrowLayout">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="0"/>
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="scrollViewer.HorizontalScrollBarVisibility" Value="Visible"></Setter>
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>