<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:CustomControl="clr-namespace:OPlanner">

    <Style TargetType="{x:Type TextBlock}">
        <Setter Property="FontFamily" Value="Arial"/>
        <Setter Property="FontSize" Value="12"/>
    </Style>
    
    <Style TargetType="{x:Type TextBox}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="FontFamily" Value="Arial"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
    </Style>

    <Style TargetType="{x:Type GridSplitter}">
        <Setter Property="Background" Value="#003366"/>
    </Style>

    <LinearGradientBrush x:Key="MainMenuBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#CCCCCC" Offset="0.0" />
        <GradientStop Color="#000000" Offset="1.0" />
    </LinearGradientBrush>
    
    <LinearGradientBrush x:Key="MainMenuDownBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#000000" Offset="0.0" />
        <GradientStop Color="#CCCCCC" Offset="1.0" />
    </LinearGradientBrush>
    
    <LinearGradientBrush x:Key="HorizontalPanelBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#008ED2" Offset="0.0" />
        <GradientStop Color="#006699" Offset="1.0" />
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="VerticalPanelBrush" StartPoint="0,0" EndPoint="1,0">
        <GradientStop Color="#008ED2" Offset="0.0" />
        <GradientStop Color="#006699" Offset="1.0" />
    </LinearGradientBrush>
    
    <LinearGradientBrush x:Key="PanelHeaderBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#00699B" Offset="0.0" />
        <GradientStop Color="#004062" Offset="1.0" />
    </LinearGradientBrush>
    
    <LinearGradientBrush x:Key="SubMenuBarBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#EEEEEE" Offset="0.0" />
        <GradientStop Color="#AAAAAA" Offset="1.0" />
    </LinearGradientBrush>

    <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="Separator">
        <Setter Property="Height" Value="1"/>
        <Setter Property="Margin" Value="0,0,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Separator">
                    <Border BorderBrush="#CCCCCC" BorderThickness="1"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="MainMenuTopLevelHeaderTemplate" TargetType="MenuItem">
        <Grid>
            <Rectangle Name="Background" Margin="0,0,0,0" Fill="Transparent"></Rectangle>
            <ContentPresenter ContentSource="Header" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="20,0,20,0" />
            <Border Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" BorderBrush="#FFFFFF" BorderThickness="0.5"></Border>
            <Popup Placement="Bottom" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False">
                <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" Background="{StaticResource MainMenuBrush}" />
            </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Background" Property="Fill" Value="#AAFF9900"/>
            </Trigger>
            <Trigger Property="IsSubmenuOpen" Value="true">
                <Setter TargetName="Background" Property="Fill" Value="{StaticResource MainMenuDownBrush}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="MainMenuTopLevelItemTemplate" TargetType="MenuItem">
        <Grid>
            <Rectangle Name="Background" Margin="0,0,0,0" Fill="Transparent"></Rectangle>
            <ContentPresenter ContentSource="Header" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="20,0,20,0" />
            <Border Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" BorderBrush="#FFFFFF" BorderThickness="0.5"></Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Background" Property="Fill" Value="#AAFF9900"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="MainMenuSubmenuItemTemplate" TargetType="MenuItem">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="30" SharedSizeGroup="Icon"/>
                <ColumnDefinition Width="*" MinWidth="70" />
                <ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut"/>
                <ColumnDefinition Width="13"/>
            </Grid.ColumnDefinitions>
            <Rectangle Name="Background" Margin="2,2,2,2" Fill="Transparent" Grid.ColumnSpan="4" StrokeThickness="1" Stroke="Transparent"></Rectangle>
            <ContentPresenter Name="Icon" Margin="6,4,6,2" VerticalAlignment="Center" ContentSource="Icon"/>
            <Border Name="Check" Width="13" Height="13" Visibility="Collapsed" Background="#FFFFFF" BorderThickness="1" BorderBrush="#000000" VerticalAlignment="Center" HorizontalAlignment="Center">
                <Path Name="CheckMark" Width="7" Height="7" Visibility="Hidden" SnapsToDevicePixels="False" Stroke="#000000" StrokeThickness="2" Data="M 0 0 L 7 7 M 0 7 L 7 0" />
            </Border>
            <ContentPresenter Name="HeaderHost" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="0,5,0,5" />
            <TextBlock x:Name="InputGestureText" Grid.Column="2" Text="{TemplateBinding InputGestureText}" Margin="5,5,0,5" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Hidden"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="CheckMark" Property="Visibility" Value="Visible"/>
            </Trigger>
            <Trigger Property="IsCheckable" Value="true">
                <Setter TargetName="Check" Property="Visibility" Value="Visible"/>
                <Setter TargetName="Icon" Property="Visibility" Value="Hidden"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Background" Property="Fill" Value="#DA8D1B"/>
                <Setter TargetName="Background" Property="Stroke" Value="#FFFFFF"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Opacity" Value="0.5"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="MainMenuSubmenuHeaderTemplate" TargetType="MenuItem">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="30" SharedSizeGroup="Icon"/>
                <ColumnDefinition Width="*" MinWidth="70" />
                <ColumnDefinition Width="Auto" SharedSizeGroup="Shortcut"/>
                <ColumnDefinition Width="13"/>
            </Grid.ColumnDefinitions>
            <Rectangle Name="Background" Margin="2,2,2,2" Fill="Transparent" Grid.ColumnSpan="4" Stroke="Transparent" StrokeThickness="1"></Rectangle>
            <ContentPresenter Name="Icon" Margin="6,4,6,2" VerticalAlignment="Center" ContentSource="Icon"/>
            <ContentPresenter Name="HeaderHost" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" Margin="0,5,0,5"/>
            <TextBlock x:Name="InputGestureText" Grid.Column="2" Text="{TemplateBinding InputGestureText}" Margin="5,5,0,5"/>
            <Path Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 0 7 L 4 3.5 Z" Fill="#FFFFFF" />
             <Popup Placement="Right" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Focusable="False">
                <StackPanel  IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Cycle" Background="{StaticResource MainMenuBrush}" />
            </Popup>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon" Property="Visibility" Value="Hidden"/>
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter TargetName="Background" Property="Fill" Value="#DA8D1B"/>
                <Setter TargetName="Background" Property="Stroke" Value="#FFFFFF"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="MainMenuTemplate" TargetType="Menu">
        <ControlTemplate.Resources>
            <Style x:Key="{x:Type MenuItem}" TargetType="MenuItem">
                <Setter Property="Foreground" Value="#FFFFFF"></Setter>
                <Setter Property="Margin" Value="0,0,0,0"></Setter>
                <Style.Triggers>
                    <Trigger Property="Role" Value="TopLevelHeader">
                        <Setter Property="Template" Value="{StaticResource MainMenuTopLevelHeaderTemplate}"/>
                    </Trigger>
                    <Trigger Property="Role" Value="TopLevelItem">
                        <Setter Property="Template" Value="{StaticResource MainMenuTopLevelItemTemplate}"/>
                    </Trigger>
                    <Trigger Property="Role" Value="SubmenuHeader">
                        <Setter Property="Template" Value="{StaticResource MainMenuSubmenuHeaderTemplate}"/>
                    </Trigger>
                    <Trigger Property="Role" Value="SubmenuItem">
                        <Setter Property="Template" Value="{StaticResource MainMenuSubmenuItemTemplate}"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </ControlTemplate.Resources>
        <StackPanel IsItemsHost="True" Orientation="Horizontal" Background="{StaticResource MainMenuBrush}" />
    </ControlTemplate>
    
    <Style x:Key="MainMenuStyle" TargetType="Menu">
        <Setter Property="Template" Value="{StaticResource MainMenuTemplate}"></Setter>
        <Setter Property="SnapsToDevicePixels" Value="True"></Setter>
    </Style>

    <ControlTemplate x:Key="RadioButtonToolTemplate" TargetType="RadioButton">
        <Grid Margin="2,2,2,2">
            <Rectangle Name="Background" Margin="0,0,0,0" Fill="#66FFFFFF"></Rectangle>
            <ContentPresenter Margin="4,4,4,4" Height="Auto" Width="Auto" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="Background" Property="Fill" Value="#CCFF9900"/>
            </Trigger>
            <Trigger Property="IsChecked" Value="True">
                <Setter TargetName="Background" Property="Fill" Value="#CCFFFFFF"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="SubMenuBarButtonTemplate" TargetType="Button">
        <Grid Margin="2,2,2,2">
            <Rectangle Name="Background" Margin="0,0,0,0" Fill="Transparent"></Rectangle>
            <ContentPresenter Margin="4,4,4,4" Height="Auto" Width="Auto" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="Background" Property="Fill" Value="#CCFF9900"/>
                <Setter TargetName="Background" Property="Stroke" Value="#000000"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="DescriptionButtonTemplate" TargetType="Button">
        <Grid Margin="2,2,2,2">
            <Rectangle Name="Background" Fill="Transparent"></Rectangle>
            <ContentPresenter Margin="2"  Height="Auto" Width="Auto" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="Background" Property="Fill" Value="#CCFF9900"/>
                <Setter TargetName="Background" Property="Stroke" Value="#000000"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="DescriptionHeaderTemplate" TargetType="Button">
        <Grid Margin="0,0,0,0">
            <Rectangle Name="Background" Fill="Transparent"></Rectangle>
            <ContentPresenter Margin="0,0,0,0" Height="Auto" Width="Auto" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter TargetName="Background" Property="Fill" Value="#CCCCCC"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="HorizontalPanel" TargetType="Panel">
        <Setter Property="Background" Value="{StaticResource HorizontalPanelBrush}"></Setter>
    </Style>
    
    <Style x:Key="VerticalPanel" TargetType="Panel">
        <Setter Property="Background" Value="{StaticResource VerticalPanelBrush}"></Setter>
    </Style>
    
    <Style x:Key="PanelHeader" TargetType="Label">
        <Setter Property="Background" Value="{StaticResource PanelHeaderBrush}"></Setter>
        <Setter Property="Foreground" Value="#FFFFFF"></Setter>
    </Style>
    
    <Style x:Key="PanelSubHeader" TargetType="Label">
        <Setter Property="Foreground" Value="#FFFFFF"></Setter>
    </Style>

    <Style x:Key="PanelSeparator" TargetType="Separator">
        <Setter Property="Background" Value="#FFFFFF"></Setter>
    </Style>

	<DataTemplate x:Key="SimpleColumnHeaderTemplate">
		<TextBlock Text="{Binding}"></TextBlock>
	</DataTemplate>
	<Style TargetType="GridViewColumnHeader" x:Key="SimpleColumnHeaderContainerStyle">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="GridViewColumnHeader">
					<ContentPresenter></ContentPresenter>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style x:Key="VerticalScrollGridViewScrollViewerStyle" TargetType="ScrollViewer">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ScrollViewer">
					<Grid Background="{TemplateBinding Background}">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="*"/>
							<ColumnDefinition Width="Auto"/>
						</Grid.ColumnDefinitions>
						<DockPanel Margin="{TemplateBinding Padding}">
							<GridViewHeaderRowPresenter DockPanel.Dock="Top" Margin="2,0,2,0"
                Columns="{Binding Path=TemplatedParent.View.Columns,
                          RelativeSource={RelativeSource TemplatedParent}}"
                ColumnHeaderContainerStyle="{StaticResource SimpleColumnHeaderContainerStyle}"
                ColumnHeaderTemplate="{StaticResource SimpleColumnHeaderTemplate}"
                ColumnHeaderTemplateSelector="{Binding 
                             Path=TemplatedParent.View.ColumnHeaderTemplateSelector,
                             RelativeSource={RelativeSource TemplatedParent}}"
                AllowsColumnReorder="{Binding
                             Path=TemplatedParent.View.AllowsColumnReorder,
                             RelativeSource={RelativeSource TemplatedParent}}"
                ColumnHeaderContextMenu="{Binding
                             Path=TemplatedParent.View.ColumnHeaderContextMenu,
                             RelativeSource={RelativeSource TemplatedParent}}"
                ColumnHeaderToolTip="{Binding
                             Path=TemplatedParent.View.ColumnHeaderToolTip,
                             RelativeSource={RelativeSource TemplatedParent}}"
                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
							<ScrollContentPresenter Name="PART_ScrollContentPresenter" KeyboardNavigation.DirectionalNavigation="Local" CanContentScroll="True" CanHorizontallyScroll="False" CanVerticallyScroll="False"/>
						</DockPanel>
						<ScrollBar Name="PART_VerticalScrollBar" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" ViewportSize="{TemplateBinding ViewportHeight}" Value="{TemplateBinding VerticalOffset}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<Style TargetType="ListViewItem" x:Key="SimpleListViewItem">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ListViewItem">
					<GridViewRowPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
		<Setter Property="Foreground" Value="#000000"></Setter>
	</Style>
	<Style x:Key="VerticalScrollListView" TargetType="ListView">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<!--<Setter Property="OverridesDefaultStyle" Value="true"/>-->
		<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
		<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
		<Setter Property="ItemContainerStyle" Value="{StaticResource SimpleListViewItem}"></Setter>
		<!--<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ListView">
					<ScrollViewer Style="{StaticResource VerticalScrollGridViewScrollViewerStyle}">
						<ItemsPresenter />
					</ScrollViewer>
				</ControlTemplate>
			</Setter.Value>
		</Setter>-->
	</Style>

</ResourceDictionary>