<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="FlexGrid101.Grouping" x:Name="page"
             xmlns:xuni="clr-namespace:Xuni.Forms.FlexGrid;assembly=Xuni.Forms.FlexGrid"
             xmlns:local="clr-namespace:FlexGrid101;assembly=FlexGrid101.Xamarin">
  <ContentPage.ToolbarItems>
    <ToolbarItem x:Name="toolbarItemSort" Clicked="OnSortClicked" Order="Primary" Priority="0">
      <ToolbarItem.Icon>
        <OnPlatform x:TypeArguments="FileImageSource" WinPhone="Assets/AppBar/appbar.sort.alphabetical.ascending.png" Android="ic_sort_ascending.png" />
      </ToolbarItem.Icon>
    </ToolbarItem>
    <ToolbarItem x:Name="toolbarItemCollapse" Clicked="OnCollapseClicked" Order="Primary" Priority="0">
      <ToolbarItem.Icon>
        <OnPlatform x:TypeArguments="FileImageSource" WinPhone="Assets/AppBar/appbar.arrow.collapsed.png" Android="ic_arrow_collapse" />
      </ToolbarItem.Icon>
    </ToolbarItem>
  </ContentPage.ToolbarItems>
  <StackLayout>
    <Label BindingContext="{x:Reference page}" Text="{Binding Title}" IsVisible="{StaticResource TitleVisible}" HorizontalOptions="Center" Font="Large"/>
    <!--<Entry x:Name="filter" Placeholder="Enter text to filter videos" Completed="OnCompleted"/>-->
    <Grid VerticalOptions="FillAndExpand">
      <xuni:FlexGrid x:Name="grid" AutoGenerateColumns="False" IsGroupingEnabled="True" GroupDisplayBinding="{Binding Key}" IsReadOnly="True">
        <xuni:FlexGrid.Columns>
          <xuni:GridColumn Binding="Active" Width="70"/>
          <xuni:GridColumn Binding="Name" Width="*"/>
          <xuni:GridColumn Binding="OrderTotal" Width="160" Format="C" Aggregate="Sum" HorizontalAlignment="End"/>
        </xuni:FlexGrid.Columns>
        <xuni:FlexGrid.Behaviors>
          <xuni:EmptyGridBehavior EmptyView="{x:Reference Name=emptyListLabel}" />
        </xuni:FlexGrid.Behaviors>
      </xuni:FlexGrid>
      <Label x:Name="emptyListLabel"
              Text="There are no items to show."
              FontSize="Large"
              HorizontalOptions="Center"/>
    </Grid>
  </StackLayout>
</ContentPage>