<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="C1.Silverlight.FlexGridExcel.SortDialog" Width="500" Height="200" KeyDown="UserControl_KeyDown" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
    
    <UserControl.Resources>
        <Style x:Key="ButtonStyle" TargetType="Button">
            <Setter Property="Padding" Value="6 4" />
            <Setter Property="Margin" Value="4 4" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="MinWidth" Value="90" />
        </Style>
    </UserControl.Resources>
    
    <Border BorderBrush="Black" BorderThickness="1 1 2 2">
    
        <Grid x:Name="LayoutRoot" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>

            <!-- caption bar -->
            <Grid Background="LightGray">
                <TextBlock Text="Sort" Margin="4 2" VerticalAlignment="Center" />
                <Border HorizontalAlignment="Right" VerticalAlignment="Stretch" Background="DarkRed" Padding="4 0" MouseLeftButtonDown="Border_MouseLeftButtonDown">
                    <TextBlock Text="x" Foreground="White" HorizontalAlignment="Center" />
                </Border>
            </Grid>

            <!-- button bar -->
            <StackPanel Orientation="Horizontal" Grid.Row="1">
                <Button Name="_btnAddLevel" Style="{StaticResource ButtonStyle}" Click="_btnAddLevel_Click">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="./Resources/AddLevel.png" Margin="4 0" />
                        <TextBlock Text="Add Level" VerticalAlignment="Center" />
                    </StackPanel>
                </Button>
                <Button Name="_btnDeleteLevel" IsEnabled="False" Style="{StaticResource ButtonStyle}" Click="_btnDeleteLevel_Click">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="./Resources/DeleteLevel.png" Margin="4 0" />
                        <TextBlock Text="Delete Level" VerticalAlignment="Center" />
                    </StackPanel>
                </Button>
                <Button Name="_btnCopyLevel" IsEnabled="False" Style="{StaticResource ButtonStyle}" Click="_btnCopyLevel_Click">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="./Resources/CopyLevel.png" Margin="4 0" />
                        <TextBlock Text="Copy Level" VerticalAlignment="Center" />
                    </StackPanel>
                </Button>
                <Button Name="_btnMoveUp" IsEnabled="False" Style="{StaticResource ButtonStyle}" MinWidth="10" Click="_btnMoveUp_Click">
                    <Image Source="./Resources/MoveUp.png" />
                </Button>
                <Button Name="_btnMoveDown" IsEnabled="False" Style="{StaticResource ButtonStyle}" MinWidth="10" Click="_btnMoveDown_Click">
                    <Image Source="./Resources/MoveDown.png" />
                </Button>
            </StackPanel>

            <!-- content area -->
            <c1:C1FlexGrid Name="_flex" Grid.Row="2" HeadersVisibility="Column" AllowSorting="False" AllowDragging="None" AllowResizing="None" SelectionMode="Row" RowBackground="Transparent" AlternatingRowBackground="Transparent" AutoGenerateColumns="False">
                <c1:C1FlexGrid.Columns>
                    <c1:Column Header="Column" Binding="{Binding PropertyName}" Width="*" />
                    <c1:Column Header="Order" Binding="{Binding Direction}" Width="*" />
                </c1:C1FlexGrid.Columns>
            </c1:C1FlexGrid>

            <!-- OK, Cancel -->
            <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Right">
                <Button Name="_btnOK" Content="OK" Style="{StaticResource ButtonStyle}" Click="_btnOK_Click" />
                <Button Name="_btnCancel" Content="Cancel" Style="{StaticResource ButtonStyle}" Click="_btnCancel_Click" />
            </StackPanel>
        </Grid>
    </Border>
</UserControl>