<?xml version="1.0" encoding="utf-8"?>
<UserControl
    x:Class="Sonex.Client.Controls.DataGridView.DataGridViewPanel"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Sonex.Client.Controls.DataGridView"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Border
        CornerRadius="10"
        Padding="0"
        BorderThickness="1"
        BorderBrush="{StaticResource CardStrokeColorDefaultBrush}"
        Background="{StaticResource CardBackgroundFillColorDefaultBrush}">

        <Grid RowSpacing="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <Border Grid.Row="0" BorderBrush="{StaticResource CardStrokeColorDefaultBrush}" BorderThickness="0,0,0,1">
                <Grid ColumnSpacing="8">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <ContentPresenter
                        x:Name="HeaderLeftContentPresenter"
                        Grid.Column="0"
                        Margin="8,0,0,0"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center" />

                    <CommandBar Grid.Column="1" HorizontalAlignment="Right" DefaultLabelPosition="Right">
                        <AppBarButton x:Name="ExportButton" Label="Export" Icon="Download" Click="ExportButton_Click" />
                        <AppBarButton x:Name="ColumnsButton" Label="Columns" Icon="View" Click="ColumnsButton_Click" />
                        <AppBarButton x:Name="FiltersButton" Label="Filters" Icon="Filter" Click="FiltersButton_Click" />
                        <AppBarButton x:Name="ClearFiltersButton" Label="Clear Filters" Icon="Clear" Click="ClearFiltersButton_Click" />
                        <AppBarButton x:Name="RefreshButton" Label="Refresh" Icon="Refresh" Click="RefreshButton_Click" />
                    </CommandBar>
                </Grid>
            </Border>

            <local:DataGridView
                x:Name="InnerDataGrid"
                Grid.Row="1"
                OnChangeActiveCell="InnerDataGrid_OnChangeActiveCell"
                OnChangeActiveRow="InnerDataGrid_OnChangeActiveRow"
                OnChangeSelection="InnerDataGrid_OnChangeSelection" />
        </Grid>
    </Border>
</UserControl>
