<?xml version="1.0" encoding="utf-8"?>
<Application x:Class="ODataX.App" 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">
  <Application.Resources>

    <!-- style for FlexGrid controls -->
    <Style TargetType="c1:C1FlexGrid">
      <Setter Property="GridLinesVisibility" Value="None" />
      <Setter Property="RowBackground" Value="Transparent" />
      <Setter Property="AlternatingRowBackground" Value="Transparent" />
      <Setter Property="IsReadOnly" Value="True" />
    </Style>

    <!-- style for Metro buttons -->
    <Style TargetType="Button" x:Key="_btnMetro">
      <Setter Property="Margin" Value="2 0" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="Button">
            <Grid>
              <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                  <VisualState x:Name="Normal" />
                  <VisualState x:Name="Pressed">
                    <Storyboard>
                      <DoubleAnimation Storyboard.TargetName="PressedElement" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="Disabled">
                    <Storyboard>
                      <DoubleAnimation Duration="0" Storyboard.TargetName="Control" Storyboard.TargetProperty="Opacity" To=".55" />
                    </Storyboard>
                  </VisualState>                  
                </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
              <Grid Name="Control">
                <Rectangle Fill="White" Stroke="#40000000" StrokeThickness="2.5" />
                <Rectangle Name="PressedElement" Fill="#20000000" StrokeThickness="2.5" Opacity="0" />
                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Margin="4" Content="{TemplateBinding Content}" />
              </Grid>
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>

    <!-- style for round Metro buttons -->
    <Style TargetType="Button" x:Key="_btnMetroRound">
      <Setter Property="Margin" Value="2 0" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="Button">
            <Grid Width="40" Height="40">
              <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                  <VisualState x:Name="Normal" />
                  <VisualState x:Name="Pressed">
                    <Storyboard>
                      <DoubleAnimation Storyboard.TargetName="PressedElement" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="Disabled">
                    <Storyboard>
                      <DoubleAnimation Duration="0" Storyboard.TargetName="Control" Storyboard.TargetProperty="Opacity" To=".55" />
                    </Storyboard>
                  </VisualState>
                </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
              <Grid Name="Control">
                <Ellipse Fill="White" Stroke="#40000000" StrokeThickness="2.5" />
                <Ellipse Name="PressedElement" Fill="#20000000" StrokeThickness="2.5" Opacity="0" />
                <ContentPresenter Content="{TemplateBinding Content}" />
              </Grid>
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>

    <!-- style for round Metro button content -->
    <Style TargetType="TextBlock" x:Key="_btnMetroRoundContent">
      <Setter Property="HorizontalAlignment" Value="Center" />
      <Setter Property="VerticalAlignment" Value="Center" />
      <Setter Property="Foreground" Value="#80000000" />
      <Setter Property="FontWeight" Value="Bold" />
      <Setter Property="FontSize" Value="26" />
      <Setter Property="Margin" Value="0 0 4 9" />
    </Style>

    <!-- style for simplified scrollbars -->
    <Style TargetType="ScrollBar">
      <Setter Property="Foreground" Value="#ffc0c0c0" />
      <Setter Property="Background" Value="#fff0f0f0" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="ScrollBar">
            <Grid x:Name="Root" Background="{TemplateBinding Background}">
              <Grid.Resources>

                <!-- RepeatButton Templates -->
                <ControlTemplate x:Key="RepeatButtonTemplate" TargetType="RepeatButton">
                  <Grid x:Name="Root" Background="Transparent" />
                </ControlTemplate>

                <!-- Horizontal Inc/Dec/Thumb Templates -->
                <ControlTemplate x:Key="HorizontalIncrementTemplate" TargetType="RepeatButton">
                  <Grid x:Name="Root">
                    <Path Stretch="Uniform" Height="8" Width="4" Data="F1 M 511.047,352.682L 511.047,342.252L 517.145,347.467L 511.047,352.682 Z " Fill="{TemplateBinding Foreground}" />
                    <Rectangle x:Name="DisabledElement" Opacity="0" RadiusX="2" RadiusY="2" Fill="#FFFFFFFF" />
                  </Grid>
                </ControlTemplate>
                <ControlTemplate x:Key="HorizontalDecrementTemplate" TargetType="RepeatButton">
                  <Grid x:Name="Root">
                    <Path Stretch="Uniform" Height="8" Width="4" Data="F1 M 110.692,342.252L 110.692,352.682L 104.594,347.467L 110.692,342.252 Z " Fill="{TemplateBinding Foreground}" />
                    <Rectangle x:Name="DisabledElement" Opacity="0" RadiusX="2" RadiusY="2" Fill="#FFFFFFFF" />
                  </Grid>
                </ControlTemplate>
                <ControlTemplate x:Key="HorizontalThumbTemplate" TargetType="Thumb">
                  <Grid x:Name="ThumbVisual" Margin="0,4,0,4">
                    <Rectangle x:Name="Background" RadiusX="4" RadiusY="4" Fill="{TemplateBinding Foreground}" Opacity=".7" />
                  </Grid>
                </ControlTemplate>

                <!-- Vertical Inc/Dec/Thumb Templates -->
                <ControlTemplate x:Key="VerticalIncrementTemplate" TargetType="RepeatButton">
                  <Grid x:Name="Root">
                    <Path Stretch="Uniform" Height="4" Width="8" Data="F1 M 531.107,321.943L 541.537,321.943L 536.322,328.042L 531.107,321.943 Z " Fill="{TemplateBinding Foreground}" />
                    <Rectangle x:Name="DisabledElement" Opacity="0" RadiusX="2" RadiusY="2" Fill="#FFFFFFFF" />
                  </Grid>
                </ControlTemplate>
                <ControlTemplate x:Key="VerticalDecrementTemplate" TargetType="RepeatButton">
                  <Grid x:Name="Root">
                    <Path Stretch="Uniform" Height="4" Width="8" Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z " Fill="{TemplateBinding Foreground}" />
                    <Rectangle x:Name="DisabledElement" Opacity="0" RadiusX="2" RadiusY="2" Fill="#FFFFFFFF" />
                  </Grid>
                </ControlTemplate>
                <ControlTemplate x:Key="VerticalThumbTemplate" TargetType="Thumb">
                  <Grid x:Name="ThumbVisual" Margin="4,0,4,0">
                    <Rectangle x:Name="Background" RadiusX="4" RadiusY="4" Fill="{TemplateBinding Foreground}" Opacity=".7" />
                  </Grid>
                </ControlTemplate>
              </Grid.Resources>

              <!-- Horizontal Template -->
              <Grid x:Name="HorizontalRoot" Background="#10000000">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <!-- Repeat Buttons + Thumb -->
                <RepeatButton x:Name="HorizontalSmallDecrease" Foreground="{TemplateBinding Foreground}" Grid.Column="0" Width="16" IsTabStop="False" Interval="50" Template="{StaticResource HorizontalDecrementTemplate}" Margin="1" />
                <RepeatButton x:Name="HorizontalLargeDecrease" Grid.Column="1" Width="0" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                <Thumb x:Name="HorizontalThumb" Background="{TemplateBinding Background}" MinWidth="18" Width="18" Grid.Column="2" Template="{StaticResource HorizontalThumbTemplate}" />
                <RepeatButton x:Name="HorizontalLargeIncrease" Grid.Column="3" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                <RepeatButton x:Name="HorizontalSmallIncrease" Foreground="{TemplateBinding Foreground}" Grid.Column="4" Width="16" IsTabStop="False" Interval="50" Template="{StaticResource HorizontalIncrementTemplate}" Margin="1" />
              </Grid>

              <!-- Vertical Template -->
              <Grid x:Name="VerticalRoot" Visibility="Collapsed" Background="#10000000">
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="*" />
                  <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <!-- Repeat Buttons + Thumb -->
                <RepeatButton x:Name="VerticalSmallDecrease" Foreground="{TemplateBinding Foreground}" Grid.Row="0" Height="16" IsTabStop="False" Interval="50" Template="{StaticResource VerticalDecrementTemplate}" Margin="1" />
                <RepeatButton x:Name="VerticalLargeDecrease" Grid.Row="1" Height="0" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                <Thumb x:Name="VerticalThumb" Background="{TemplateBinding Background}" MinHeight="18" Height="18" Grid.Row="2" Template="{StaticResource VerticalThumbTemplate}" />
                <RepeatButton x:Name="VerticalLargeIncrease" Grid.Row="3" Template="{StaticResource RepeatButtonTemplate}" Interval="50" IsTabStop="False" />
                <RepeatButton x:Name="VerticalSmallIncrease" Foreground="{TemplateBinding Foreground}" Grid.Row="4" Height="16" IsTabStop="False" Interval="50" Template="{StaticResource VerticalIncrementTemplate}" Margin="1" />
              </Grid>
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>

  </Application.Resources>
</Application>