<Application x:Class="VirtualCanvasTestCode.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:core="clr-namespace:System;assembly=mscorlib"

             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <core:Double x:Key="ImageWidth">200</core:Double>
        <core:Double x:Key="ImageHeight">200</core:Double>
        <ImageBrush x:Key="BackgroundBrush" ImageSource="pack://application:,,,/VirtualCanvasTestCode;component/Resources/Images/NewBlack.jpg"/>

        <Style x:Key="RepeatBorderlessButtonStyle" TargetType="RepeatButton">
            <Setter Property="Background" Value="{StaticResource BackgroundBrush}"/>
            <Setter Property="OverridesDefaultStyle" Value="True" />
            <Setter Property="Cursor" Value="Hand" />
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="RepeatButton">
                        <Border Name="border" CornerRadius="7" BorderThickness="0" BorderBrush="Black" Background="{TemplateBinding Background}">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Opacity" Value="0.8" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="FontSize" Value="12"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="Background" Value="Transparent"/>
        </Style>

        <Style TargetType="{x:Type TextBox}">
            <Setter Property="FontSize" Value="24"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="CaretBrush" Value="White"/>
            <Setter Property="BorderBrush" Value="Transparent"/>
        </Style>

        <DataTemplate x:Key="comboTempl">
            <RibbonComboBox Foreground="Black">
                <RibbonComboBox.Items>
                    <ComboBoxItem>1</ComboBoxItem>
                    <ComboBoxItem>2</ComboBoxItem>
                    <ComboBoxItem>3</ComboBoxItem>
                    <ComboBoxItem>4</ComboBoxItem>
                    <ComboBoxItem>5</ComboBoxItem>
                    <ComboBoxItem>6</ComboBoxItem>
                    <ComboBoxItem>7</ComboBoxItem>
                    <ComboBoxItem>8</ComboBoxItem>
                    <ComboBoxItem>9</ComboBoxItem>
                    <ComboBoxItem>10</ComboBoxItem>
                    <ComboBoxItem>11</ComboBoxItem>
                    <ComboBoxItem>12</ComboBoxItem>
                </RibbonComboBox.Items>
            </RibbonComboBox>
        </DataTemplate>

        <Style TargetType="Button" x:Key="TabButton">
            <Setter Property="TextBlock.TextAlignment" Value="Center" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border 
                                CornerRadius="{TemplateBinding Border.CornerRadius}" 
                                Background="{TemplateBinding Background}" 
                                BorderBrush="{TemplateBinding BorderBrush}" 
                                BorderThickness="{TemplateBinding BorderThickness}"
                             >

                            <ContentPresenter x:Name="contentPresenter" 
                                    ContentTemplate="{TemplateBinding ContentTemplate}" 
                                    Content="{TemplateBinding Content}" 
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    Margin="{TemplateBinding Padding}" 
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            </ContentPresenter>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!--
        
        <DataTemplate x:Key="buttonTempl">
            <RibbonButton Label="{Binding Header}" FontSize="8"
                              Command="{Binding Path=Command}" 
                              CommandParameter="{Binding Path=DataContext,RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
                              Width="{Binding Path=Width}" 
                              Height="{Binding Path=Height}"
                              LargeImageSource="{Binding Path=ImageSource}"
                              SmallImageSource="{Binding Path=SmallImageSource}"
                          />
        </DataTemplate>

        <Style TargetType="RibbonGroup" x:Key="groupStyle">
            <Setter Property="HeaderTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <TextBlock Text="{Binding Path=Header}" Foreground="Black" Background="Transparent" FontWeight="Bold"/>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemsSource" Value="{Binding Items}"/>
            <Setter Property="ItemTemplate" Value="{StaticResource buttonTempl}"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=RibbonItemType}" Value="ComboBox">
                    <Setter Property="ItemTemplate" Value="{StaticResource comboTempl}"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="RibbonTab" x:Key="tabStyle">
            <Setter Property="Header" Value="{Binding Header}"/>
            <Setter Property="ItemsSource" Value="{Binding Items}"/>
            <Setter Property="ItemContainerStyle" Value="{StaticResource groupStyle}"/>
        </Style>

        <Style TargetType="RibbonTabHeader">
            <Setter Property="Foreground" Value="White"/>
            <Style.Triggers>
                <Trigger Property="IsRibbonTabSelected" Value="True">
                    <Setter Property="Foreground" Value="Black"/>
                </Trigger>
            </Style.Triggers>
        </Style>
-->

        <DataTemplate x:Key="buttonTempl">
            <RibbonButton Label="{Binding Header}" 
                      Command="{Binding Path=Command}" 
                      CommandParameter="{Binding Path=CommandParameter}"
                      Width="{Binding Path=Width}" 
                      Height="{Binding Path=Height}"
                      LargeImageSource="{Binding Path=ImageSource}"
                      SmallImageSource="{Binding Path=SmallImageSource}"
                      ControlSizeDefinition="{Binding Path=ControlSize}"
                      Foreground="Black"
                     />
        </DataTemplate>

        <Style TargetType="RibbonGroup" x:Key="groupStyle">
            <Setter Property="HeaderTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <TextBlock Text="{Binding Path=Header}" Foreground="Black" Background="Transparent" FontWeight="Bold"/>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemsSource" Value="{Binding Items}"/>
            <Setter Property="ItemTemplate" Value="{StaticResource buttonTempl}"/>
            <Setter Property="Foreground" Value="Black"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=RibbonItemType}" Value="ComboBox">
                    <Setter Property="ItemTemplate" Value="{StaticResource comboTempl}"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=GroupOrientation}" Value="Vertical">
                    <Setter Property="ItemsPanel">
                        <Setter.Value>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Vertical" IsItemsHost="True" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                            </ItemsPanelTemplate>
                        </Setter.Value>
                    </Setter>
                    <!--<Setter Property="HeaderTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=Header}" Foreground="Red" Background="Transparent" FontWeight="Bold"/>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>-->
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="RibbonTab" x:Key="tabStyle">
            <Setter Property="Header" Value="{Binding Header}"/>
            <Setter Property="ItemsSource" Value="{Binding Items}"/>
            <Setter Property="ItemContainerStyle" Value="{StaticResource groupStyle}"/>
            <Setter Property="Background" Value="Black"/>
        </Style>

    </Application.Resources>
</Application>
