<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="ExcelGrid.MainPage" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="480" FontFamily="Segoe UI" FontSize="13" 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">
    <Grid Name="LayoutRoot" Background="#D3E2F1">

        <Grid.Resources>

            <!-- styles for the mini-ribbon -->
            <Style x:Key="RbGroup" TargetType="Border">
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="BorderBrush" Value="#50000000" />
                <Setter Property="CornerRadius" Value="4" />
                <Setter Property="Margin" Value="0 0 2 0" />
            </Style>
            <Style x:Key="RbGroupContent" TargetType="StackPanel">
                <Setter Property="Orientation" Value="Horizontal" />
                <Setter Property="Height" Value="70" />
                <Setter Property="Margin" Value="0 0 4 0" />
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0 1">
                            <GradientStop Color="Transparent" Offset="0" />
                            <GradientStop Color="#10000000" Offset=".25" />
                            <GradientStop Color="#10000000" Offset=".75" />
                            <GradientStop Color="Transparent" Offset="1" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="RbGroupCaption" TargetType="Border">
                <Setter Property="Background" Value="#20000000" />
            </Style>
            <Style x:Key="RbGroupTitle" TargetType="TextBlock">
                <Setter Property="HorizontalAlignment" Value="Center" />
                <Setter Property="FontSize" Value="9" />
            </Style>
            <Style x:Key="RbVPanel" TargetType="StackPanel">
                <Setter Property="Orientation" Value="Vertical" />
                <Setter Property="VerticalAlignment" Value="Center" />
            </Style>
            <Style x:Key="RbBigBtn" TargetType="Button">
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="Margin" Value="4 0 0 0" />
                <Setter Property="MinWidth" Value="45" />
                <Setter Property="MinHeight" Value="60" />
            </Style>
            <Style x:Key="RbSmallBtn" TargetType="Button">
                <Setter Property="Margin" Value="4 0 0 0" />
                <Setter Property="Padding" Value="4 2" />
            </Style>
            
            <!-- CellStyle for the grid header row -->
            <c1:CellStyle x:Key="HeaderRowStyle" FontWeight="Bold" Background="#ff8080c0" Foreground="#ffffcf00" HorizontalAlignment="Left" />

            <!-- CellStyle for cells that contain errors -->
            <c1:CellStyle x:Key="ErrorStyle" FontWeight="Bold" BorderBrush="#ffdc000c" Background="#ffffe0e0" BorderThickness="2" CornerRadius="2" />
        </Grid.Resources>

        <!-- title, mini-ribbon, grid, status -->
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>

        <!-- title -->
        <TextBlock Text="ComponentOne FlexGridExcel Sample" Foreground="#50000000" FontWeight="Bold" FontSize="14" Margin="0 4" />
        
        <!-- mini-ribbon -->
        <Grid HorizontalAlignment="Stretch" Grid.Row="1">
            <ContentControl FontSize="11">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">

                    <!-- save -->
                    <Border Style="{StaticResource RbGroup}">
                        <StackPanel Orientation="Vertical">
                            <StackPanel Style="{StaticResource RbGroupContent}">
                                <Button Name="_btnSave" Style="{StaticResource RbBigBtn}" Click="_btnSave_Click">
                                    <StackPanel Orientation="Vertical">
                                        <Image Source="./Resources/SaveAs_large.png" Stretch="None" />
                                        <TextBlock Text="Save" HorizontalAlignment="Center" />
                                    </StackPanel>
                                </Button>
                                <StackPanel Style="{StaticResource RbVPanel}">
                                    <Button Name="_btnSavePdf" Style="{StaticResource RbSmallBtn}" Click="_btnSavePdf_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="./Resources/PDF_small.png" Stretch="None" />
                                            <TextBlock Text=" PDF " VerticalAlignment="Center" />
                                        </StackPanel>
                                    </Button>
                                    <Button Name="_btnSaveHtml" Style="{StaticResource RbSmallBtn}" Click="_btnSaveHtml_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="./Resources/Html_small.png" Stretch="None" />
                                            <TextBlock Text=" Html " VerticalAlignment="Center" />
                                        </StackPanel>
                                    </Button>
                                    <Button Name="_btnSaveText" Style="{StaticResource RbSmallBtn}" Click="_btnSaveText_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="./Resources/Text_small.png" Stretch="None" />
                                            <TextBlock Text=" Text " VerticalAlignment="Center" />
                                        </StackPanel>
                                    </Button>
                                </StackPanel>
                            </StackPanel>
                            <Border Style="{StaticResource RbGroupCaption}">
                                <TextBlock Text="File" HorizontalAlignment="Center" FontSize="9" />
                            </Border>
                        </StackPanel>
                    </Border>

                    <!-- clipboard -->
                    <Border Style="{StaticResource RbGroup}">
                        <StackPanel Orientation="Vertical">
                            <StackPanel Style="{StaticResource RbGroupContent}">
                                <Button Name="_btnPaste" Style="{StaticResource RbBigBtn}" Click="_btnPaste_Click">
                                    <StackPanel Orientation="Vertical">
                                        <Image Source="./Resources/Paste_large.png" Stretch="None" />
                                        <TextBlock Text="Paste" HorizontalAlignment="Center" />
                                    </StackPanel>
                                </Button>
                                <StackPanel Style="{StaticResource RbVPanel}">
                                    <Button Name="_btnCut" Style="{StaticResource RbSmallBtn}" Click="_btnCut_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="./Resources/Cut_small.png" Stretch="None" />
                                            <TextBlock Text=" Cut " />
                                        </StackPanel>
                                    </Button>
                                    <Button Name="_btnCopy" Style="{StaticResource RbSmallBtn}" Click="_btnCopy_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="./Resources/Copy_small.png" Stretch="None" />
                                            <TextBlock Text=" Copy " />
                                        </StackPanel>
                                    </Button>
                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                        <Button Name="_btnUndo" Click="_btnUndo_Click" ToolTipService.ToolTip="Undo" IsEnabled="{Binding CanUndo, ElementName=_flex }">
                                            <Image Source="./Resources/Undo_small.png" />
                                        </Button>
                                        <Button Name="_btnRedo" Click="_btnRedo_Click" ToolTipService.ToolTip="Redo" IsEnabled="{Binding CanRedo, ElementName=_flex }">
                                            <Image Source="./Resources/Redo_small.png" />
                                        </Button>
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>
                            <Border Style="{StaticResource RbGroupCaption}">
                                <TextBlock Text="Clipboard" HorizontalAlignment="Center" FontSize="9" />
                            </Border>
                        </StackPanel>
                    </Border>

                    <!-- print -->
                    <Border Style="{StaticResource RbGroup}">
                        <StackPanel Orientation="Vertical">
                            <StackPanel Style="{StaticResource RbGroupContent}">
                                <Button Name="_btnPrint" Style="{StaticResource RbBigBtn}" Click="_btnPrint_Click">
                                    <StackPanel Orientation="Vertical">
                                        <Image Source="./Resources/Print_large.png" Stretch="None" />
                                        <TextBlock Text="Print" HorizontalAlignment="Center" />
                                    </StackPanel>
                                </Button>
                                <StackPanel Style="{StaticResource RbVPanel}">
                                    <Button Name="_btnPrintPageWidth" Style="{StaticResource RbSmallBtn}" Click="_btnPrint_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="./Resources/PageWidth_small.png" Stretch="None" />
                                            <TextBlock Text=" Page Width " VerticalAlignment="Center" />
                                        </StackPanel>
                                    </Button>
                                    <Button Name="_btnPrintSinglePage" Style="{StaticResource RbSmallBtn}" Click="_btnPrint_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="./Resources/PageBorders_small.png" Stretch="None" />
                                            <TextBlock Text=" Single Page " VerticalAlignment="Center" />
                                        </StackPanel>
                                    </Button>
                                    <Button Name="_btnPrintSelection" Style="{StaticResource RbSmallBtn}" Click="_btnPrint_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="./Resources/Select_small.png" Stretch="None" />
                                            <TextBlock Text=" Selection " VerticalAlignment="Center" />
                                        </StackPanel>
                                    </Button>
                                </StackPanel>
                            </StackPanel>
                            <Border Style="{StaticResource RbGroupCaption}">
                                <TextBlock Text="Print" HorizontalAlignment="Center" FontSize="9" />
                            </Border>
                        </StackPanel>
                    </Border>

                    <!-- group -->
                    <Border Style="{StaticResource RbGroup}">
                        <StackPanel Orientation="Vertical">
                            <StackPanel Style="{StaticResource RbGroupContent}">
                                <Button Name="_btnGroup" Style="{StaticResource RbBigBtn}" MinWidth="55" Click="_btnGroup_Click">
                                    <StackPanel Orientation="Vertical">
                                        <Image Source="./Resources/GroupData_large.png" Stretch="None" />
                                        <TextBlock Text="Group" HorizontalAlignment="Center" />
                                    </StackPanel>
                                </Button>
                                <StackPanel Style="{StaticResource RbVPanel}">
                                    <Button Name="_btnUngroup" Style="{StaticResource RbBigBtn}" Click="_btnUngroup_Click">
                                        <StackPanel Orientation="Vertical">
                                            <Image Source="./Resources/UngroupData_large.png" Stretch="None" />
                                            <TextBlock Text="Ungroup" HorizontalAlignment="Center" />
                                        </StackPanel>
                                    </Button>
                                </StackPanel>

                                <StackPanel Style="{StaticResource RbVPanel}">
                                    <Button Name="_btnShowDetail" Style="{StaticResource RbSmallBtn}" Click="_btnShowDetail_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="./Resources/ShowDetail_small.png" Stretch="None" />
                                            <TextBlock Text=" Show Detail " />
                                        </StackPanel>
                                    </Button>
                                    <Button Name="_btnHideDetail" Style="{StaticResource RbSmallBtn}" Click="_btnHideDetail_Click">
                                        <StackPanel Orientation="Horizontal">
                                            <Image Source="./Resources/HideDetail_small.png" Stretch="None" />
                                            <TextBlock Text=" Hide Detail " />
                                        </StackPanel>
                                    </Button>
                                    <CheckBox Name="_chkTotalsBelow" Content="Totals Below" Margin="4 0 0 0" Click="_chkTotalsBelow_Click" />
                                </StackPanel>
                            </StackPanel>
                            <Border Style="{StaticResource RbGroupCaption}">
                                <TextBlock Text="Group" HorizontalAlignment="Center" FontSize="9" />
                            </Border>
                        </StackPanel>
                    </Border>

                    <!-- view -->
                    <Border Style="{StaticResource RbGroup}">
                        <StackPanel Orientation="Vertical">
                            <StackPanel Style="{StaticResource RbGroupContent}">
                                <Button Name="_btnFreeze" Style="{StaticResource RbBigBtn}" Click="_btnFreeze_Click">
                                    <StackPanel Orientation="Vertical">
                                        <Image Source="./Resources/FreezePanes_large.png" Stretch="None" />
                                        <TextBlock Text="Freeze" HorizontalAlignment="Center" />
                                    </StackPanel>
                                </Button>
                                <StackPanel Style="{StaticResource RbVPanel}" Margin="2 0">
                                    <CheckBox Name="_chkGridlines" Content="Gridlines" IsChecked="True" VerticalAlignment="Center" Margin="0 2" Click="_chkGridlines_Click" />
                                    <CheckBox Name="_chkHeadings" Content="Headings" IsChecked="True" VerticalAlignment="Center" Margin="0 2" Click="_chkHeadings_Click" />
                                    <ComboBox Name="_cmbColor" SelectedIndex="0" Width="65" SelectionChanged="ComboBox_ColorSchemeChanged">
                                        <ComboBox.Items>
                                            <ComboBoxItem Content="Blue" />
                                            <ComboBoxItem Content="Silver" />
                                            <ComboBoxItem Content="Black" />
                                        </ComboBox.Items>
                                    </ComboBox>
                                </StackPanel>
                            </StackPanel>
                            <Border Style="{StaticResource RbGroupCaption}">
                                <TextBlock Text="View" HorizontalAlignment="Center" FontSize="9" />
                            </Border>
                        </StackPanel>
                    </Border>

                    <!-- editing -->
                    <Border Style="{StaticResource RbGroup}">
                        <StackPanel Orientation="Vertical">
                            <StackPanel Style="{StaticResource RbGroupContent}">
                                <Button Name="_btnSort" Style="{StaticResource RbBigBtn}" Click="_btnSort_Click">
                                    <StackPanel Orientation="Vertical">
                                        <Image Source="./Resources/Sort_large.png" Stretch="None" />
                                        <TextBlock Text="Sort" HorizontalAlignment="Center" />
                                    </StackPanel>
                                </Button>
                                <Button Name="_btnFilter" Style="{StaticResource RbBigBtn}" Click="_btnFilter_Click">
                                    <StackPanel Orientation="Vertical">
                                        <Image Source="./Resources/SortAndFilter_large.png" Stretch="None" />
                                        <TextBlock Text="Filter" HorizontalAlignment="Center" />
                                    </StackPanel>
                                </Button>
                            </StackPanel>
                            <Border Style="{StaticResource RbGroupCaption}">
                                <TextBlock Text="Editing" HorizontalAlignment="Center" FontSize="9" />
                            </Border>
                        </StackPanel>
                    </Border>
                </StackPanel>
            </ContentControl>
        </Grid>

        <c1:C1FlexGridExcel Name="_flex" Grid.Row="2" Background="DarkGray" Margin="0 4 0 0" BorderThickness="1" HeaderRowStyle="{StaticResource HeaderRowStyle}" ErrorStyle="{StaticResource ErrorStyle}" BorderBrush="#c0000000" />
        <TextBlock Name="_tbStatus" Text="Ready" Margin="6 2" HorizontalAlignment="Right" Grid.Row="4" />
    </Grid>
</UserControl>