<Window x:Class="ExcelBook.MainWindow"
        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"
        Title="ExcelBook WPF" Height="450" Width="800" WindowStartupLocation="CenterScreen">

  <!-- layout root -->
  <Grid Name="LayoutRoot" Background="#D6DCE7">

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

    <!-- title -->
    <TextBlock
    Text="ComponentOne FlexGridBook Sample"
    Foreground="#50000000"
    FontWeight="Bold"
    FontSize="14"
    Margin="0 4"/>

    <!-- ribbon -->
    <c1:C1Toolbar Name="_ribbon" Grid.Row="1" FontSize="11">
      <c1:C1ToolbarGroup Header="File">
        <c1:C1ToolbarGroup.GroupSizeDefinitions>
          <c1:C1ToolbarGroupSizeDefinition>
            <c1:C1ToolbarControlSize>Large</c1:C1ToolbarControlSize>
          </c1:C1ToolbarGroupSizeDefinition>
        </c1:C1ToolbarGroup.GroupSizeDefinitions>
        <c1:C1ToolbarButton Name="_btnOpen" LabelTitle="Open" LargeImageSource="./Resources/Open_large.png" Click="_btnOpen_Click" />
        <c1:C1ToolbarButton Name="_btnSave" LabelTitle="Save" LargeImageSource="./Resources/SaveAs_large.png" Click="_btnSave_Click"/>
      </c1:C1ToolbarGroup>
      <c1:C1ToolbarGroup Header="Clipboard">
        <c1:C1ToolbarButton Name="_btnPaste" LabelTitle="Paste" LargeImageSource="./Resources/Paste_large.png" Click="_btnPaste_Click" />
        <c1:C1ToolbarButton Name="_btnCut" LabelTitle="Cut" SmallImageSource="./Resources/Cut_small.png" Click="_btnCut_Click" />
        <c1:C1ToolbarButton Name="_btnCopy" LabelTitle="Copy" SmallImageSource="./Resources/Copy_small.png" Click="_btnCopy_Click" />
        <c1:C1ToolbarStrip HorizontalAlignment="Right">
          <c1:C1ToolbarButton Name="_btnUndo" Click="_btnUndo_Click" ToolTipService.ToolTip="Undo" IsEnabled="{Binding CanUndo, ElementName=_flex }">
            <Image Source="./Resources/Undo_small.png" />
          </c1:C1ToolbarButton>
          <c1:C1ToolbarButton Name="_btnRedo" Click="_btnRedo_Click" ToolTipService.ToolTip="Redo" IsEnabled="{Binding CanUndo, ElementName=_flex }">
            <Image Source="./Resources/Redo_small.png" />
          </c1:C1ToolbarButton>
        </c1:C1ToolbarStrip>
      </c1:C1ToolbarGroup>
      <c1:C1ToolbarGroup Header="Format">
        <c1:C1ToolbarStrip>
          <c1:C1ToolbarButton Name="_btnBold" Click="_btnBold_Click" ToolTipService.ToolTip="Bold">
            <Image Source="./Resources/Bold_small.png" Stretch="None"/>
          </c1:C1ToolbarButton>
          <c1:C1ToolbarButton Name="_btnItalic" Click="_btnItalic_Click" ToolTipService.ToolTip="Italic">
            <Image Source="./Resources/Italic_small.png" />
          </c1:C1ToolbarButton>
          <c1:C1ToolbarButton Name="_btnUnderline" Click="_btnUnderline_Click" ToolTipService.ToolTip="Underline">
            <Image Source="./Resources/Underline_small.png" />
          </c1:C1ToolbarButton>
        </c1:C1ToolbarStrip>
        <c1:C1ToolbarStrip>
          <c1:C1ToolbarButton Name="_btnLeft" Click="_btnLeft_Click" ToolTipService.ToolTip="Align Left">
            <Image Source="./Resources/AlignTextLeft_small.png" />
          </c1:C1ToolbarButton>
          <c1:C1ToolbarButton Name="_btnCenter" Click="_btnCenter_Click" ToolTipService.ToolTip="Align Center" >
            <Image Source="./Resources/AlignTextCenter_small.png" />
          </c1:C1ToolbarButton>
          <c1:C1ToolbarButton Name="_btnRight" Click="_btnRight_Click" ToolTipService.ToolTip="Align Right" >
            <Image Source="./Resources/AlignTextRight_small.png" />
          </c1:C1ToolbarButton>
        </c1:C1ToolbarStrip>
        <c1:C1ToolbarStrip>
          <c1:C1ToolbarButton Name="_btnTop" Click="_btnTop_Click" ToolTipService.ToolTip="Align Top" >
            <Image Source="./Resources/AlignTextTop_small.png" />
          </c1:C1ToolbarButton>
          <c1:C1ToolbarButton Name="_btnMiddle" Click="_btnMiddle_Click" ToolTipService.ToolTip="Align Middle" >
            <Image Source="./Resources/AlignTextMiddle_small.png" />
          </c1:C1ToolbarButton>
          <c1:C1ToolbarButton Name="_btnBottom" Click="_btnBottom_Click" ToolTipService.ToolTip="Align Bottom" >
            <Image Source="./Resources/AlignTextBottom_small.png" />
          </c1:C1ToolbarButton>
        </c1:C1ToolbarStrip>
      </c1:C1ToolbarGroup>
      
      <c1:C1ToolbarGroup Header="Background">
        <c1:C1ToolbarStrip>
            <c1:C1ToolbarButton Name="_btnBlue" Click="_btnBlue_Click" ToolTipService.ToolTip="Blue Background" >
              <Rectangle Fill="Blue" Width="20" Height="16" />
            </c1:C1ToolbarButton>
            <c1:C1ToolbarButton Name="_btnYellow" Click="_btnYellow_Click" ToolTipService.ToolTip="Yellow Background" >
              <Rectangle Fill="Yellow" Width="20" Height="16" />
            </c1:C1ToolbarButton>
            <c1:C1ToolbarButton Name="_btnOrange" Click="_btnOrange_Click" ToolTipService.ToolTip="Orange Background" >
              <Rectangle Fill="Orange" Width="20" Height="16" />
            </c1:C1ToolbarButton>
        </c1:C1ToolbarStrip>
        <c1:C1ToolbarStrip>
          <c1:C1ToolbarButton Name="_btnRed" Click="_btnRed_Click" ToolTipService.ToolTip="Red Background" >
            <Rectangle Fill="Red" Width="20" Height="16" />
          </c1:C1ToolbarButton>
          <c1:C1ToolbarButton Name="_btnGreen" Click="_btnGreen_Click" ToolTipService.ToolTip="Green Background" >
            <Rectangle Fill="Green" Width="20" Height="16" />
          </c1:C1ToolbarButton>
          <c1:C1ToolbarButton Name="_btnNoColor" Click="_btnNoColor_Click" ToolTipService.ToolTip="No Background" >
            <Rectangle Fill="White" Width="20" Height="16" />
          </c1:C1ToolbarButton>
        </c1:C1ToolbarStrip>
      </c1:C1ToolbarGroup>
        
      <c1:C1ToolbarGroup Header="Print">
        <c1:C1ToolbarButton Name="_btnPrint" LabelTitle="Print" LargeImageSource="./Resources/Print_large.png" Click="_btnPrint_Click" />
        <c1:C1ToolbarButton Name="_btnPrintPageWidth" LabelTitle="Page Width" SmallImageSource="./Resources/PageWidth_small.png" Click="_btnPrint_Click" />
        <c1:C1ToolbarButton Name="_btnPrintSinglePage" LabelTitle="Single Page" SmallImageSource="./Resources/PageBorders_small.png" Click="_btnPrint_Click" />
        <c1:C1ToolbarButton Name="_btnPrintSelection" LabelTitle="Selection" SmallImageSource="./Resources/Select_small.png" Click="_btnPrint_Click" />
      </c1:C1ToolbarGroup>
      <c1:C1ToolbarGroup Header="Group">
        <c1:C1ToolbarGroup.GroupSizeDefinitions>
          <c1:C1ToolbarGroupSizeDefinition>
            <c1:C1ToolbarControlSize>Large</c1:C1ToolbarControlSize>
            <c1:C1ToolbarControlSize>Large</c1:C1ToolbarControlSize>
            <c1:C1ToolbarControlSize>Medium</c1:C1ToolbarControlSize>
          </c1:C1ToolbarGroupSizeDefinition>
        </c1:C1ToolbarGroup.GroupSizeDefinitions>
        <c1:C1ToolbarButton Name="_btnGroup" LabelTitle="Group" LargeImageSource="./Resources/GroupData_large.png" Click="_btnGroup_Click" />
        <c1:C1ToolbarButton Name="_btnUngroup" LabelTitle="Ungroup" LargeImageSource="./Resources/UngroupData_large.png" Click="_btnUngroup_Click" />
        <c1:C1ToolbarButton Name="_btnShowDetail" LabelTitle="Show Detail" SmallImageSource="./Resources/ShowDetail_small.png" Click="_btnShowDetail_Click" />
        <c1:C1ToolbarButton Name="_btnHideDetail" LabelTitle="Hide Detail" SmallImageSource="./Resources/HideDetail_small.png" Click="_btnHideDetail_Click" />
        <c1:C1ToolbarButton Name="_btnMerge" LabelTitle="Merge" SmallImageSource="./Resources/HideDetail_small.png" Click="_btnMerge_Click"  />
      </c1:C1ToolbarGroup>
      <c1:C1ToolbarGroup Header="View">
        <c1:C1ToolbarButton Name="_btnFreeze" LabelTitle="Freeze" LargeImageSource="./Resources/FreezePanes_large.png" Click="_btnFreeze_Click" />
        <CheckBox Name="_chkGridlines" Content="Gridlines" IsChecked="True" Margin="3" Click="_chkGridlines_Click"/>
        <CheckBox Name="_chkHeadings" Content="Headings" IsChecked="True" Margin="3" Click="_chkHeadings_Click"/>
        <ComboBox Name="_cmbColor" SelectedIndex="0" Margin="3" SelectionChanged="ComboBox_ColorSchemeChanged">
          <ComboBox.Items>
            <ComboBoxItem Content="Blue" />
            <ComboBoxItem Content="Silver" />
            <ComboBoxItem Content="Black" />
          </ComboBox.Items>
        </ComboBox>
      </c1:C1ToolbarGroup>
      <c1:C1ToolbarGroup Header="Editing">
        <c1:C1ToolbarGroup.GroupSizeDefinitions>
          <c1:C1ToolbarGroupSizeDefinition>
            <c1:C1ToolbarControlSize>Large</c1:C1ToolbarControlSize>
          </c1:C1ToolbarGroupSizeDefinition>
        </c1:C1ToolbarGroup.GroupSizeDefinitions>
        <c1:C1ToolbarButton Name="_btnSort" LabelTitle="Sort" LargeImageSource="./Resources/Sort_large.png" Click="_btnSort_Click" />
        <c1:C1ToolbarButton Name="_btnFilter" LabelTitle="Filter" LargeImageSource="./Resources/SortAndFilter_large.png" Click="_btnFilter_Click" />
      </c1:C1ToolbarGroup>
    </c1:C1Toolbar>

    <!-- formula bar -->
    <Grid Grid.Row="2" Background="White" >
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="80" />
        <ColumnDefinition Width="80" />
        <ColumnDefinition />
      </Grid.ColumnDefinitions>
      <TextBlock Name="_tbAddress" Text="A1" HorizontalAlignment="Center" VerticalAlignment="Center" />
      <Border Name="_tbFx" Background="LightGray" Grid.Column="1" CornerRadius="10 0 0 10" BorderBrush="#80000000" BorderThickness="1" >
        <TextBlock Text="fx" HorizontalAlignment="Right" FontStyle="Italic" Margin="6 0" />
      </Border>
      <TextBox Name="_txtFormula" Grid.Column="2" Padding="4 0" />
    </Grid>

    <!-- book -->
    <c1:C1FlexGridBook
      Name="_flex" Grid.Row="3"
      Background="DarkGray"
      ColorScheme="Blue"
      Margin="0 4 0 0"
      BorderThickness="1"
      BorderBrush="#c0000000" />

    <!-- status bar -->
    <TextBlock
      Name="_tbStatus"
      Grid.Row="5"
      Text="Ready"
      Margin="6 2"
      HorizontalAlignment="Right" />
  </Grid>
</Window>
