<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="CustomUI.MainPage" mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" FontFamily="Segoe UI" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" xmlns:olap="clr-namespace:C1.Silverlight.Olap;assembly=C1.Silverlight.Olap.5">
  <Grid x:Name="LayoutRoot">

    <Grid.Resources>
      <Style x:Key="_border" TargetType="Border">
        <Setter Property="BorderThickness" Value="2,2,6,6" />
        <Setter Property="CornerRadius" Value="8" />
        <Setter Property="BorderBrush" Value="Gray" />
        <Setter Property="Background" Value="WhiteSmoke" />
        <Setter Property="Margin" Value="4" />
      </Style>
    </Grid.Resources>
    
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="*" />
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>

    <!-- title -->
    <TextBlock Text="My Custom Olap Application" FontSize="24" FontWeight="Bold" Grid.ColumnSpan="4" />

    <!-- commands -->
    <Border Grid.Row="1" Style="{StaticResource _border}">
      <StackPanel Margin="24">

        <TextBlock Text="View Sales by:" FontWeight="Bold" Margin="0 24 0 0" />

        <Button x:Name="_btnSalesperson" Padding="4" Click="_btnSalesperson_Click">
          <StackPanel>
            <Image Source="Resources/salesperson.png" ImageFailed="Image_ImageFailed" />
            <TextBlock Text="Sales Person" />
          </StackPanel>
        </Button>
        <Button x:Name="_btnProduct" Padding="4" Click="_btnProduct_Click">
          <StackPanel>
            <Image Source="Resources/product.png" />
            <TextBlock Text="Product" />
          </StackPanel>
        </Button>
        <Button x:Name="_btnCountry" Padding="4" Click="_btnCountry_Click">
          <StackPanel>
            <Image Source="Resources/country.png" />
            <TextBlock Text="Country" />
          </StackPanel>
        </Button>

        <TextBlock Text="Price Filter:" FontWeight="Bold" Margin="0 24 0 0" />

        <Button x:Name="_btnExpensive" Content="$$$ Expensive" Padding="4" Click="_btnExpensive_Click" />
        <Button x:Name="_btnModerate" Content="$$ Moderate" Padding="4" Click="_btnModerate_Click" />
        <Button x:Name="_btnInexpensive" Content="$ Inexpensive" Padding="4" Click="_btnInexpensive_Click" />
        <Button x:Name="_btnAllPrices" Content="* All Prices" Padding="4" Click="_btnAllPrices_Click" />

      </StackPanel>
    </Border>

    <!-- olap grid -->
    <Border Style="{StaticResource _border}" Grid.Row="1" Grid.Column="1">
      <olap:C1OlapGrid x:Name="_olapGrid" Margin="4" SortedColumn="_olapGrid_SortedColumn" />
    </Border>

    <!-- splitter -->
    <c:GridSplitter Grid.Column="2" Width="6" Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Center" Background="WhiteSmoke" />

    <!-- olap chart -->
    <Border Style="{StaticResource _border}" Grid.Row="1" Grid.Column="3">
      <olap:C1OlapChart x:Name="_olapChart" Margin="4" />
    </Border>

  </Grid>
</UserControl>