<localView:BeWoView x:Class="BeWo.View.Detail.AssessmentSheetEntryView" 
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:localView="clr-namespace:BeWo.View"
                    xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
                    Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True"
                    xmlns:conv="clr-namespace:BeWo.Converter" 
                    xmlns:controls="clr-namespace:BeWo.View.Controls">
    <localView:BeWoView.Resources>
        <DataTemplate x:Key="LayoutPanelCaptionTemplateWithoutButtons">
            <Border BorderThickness="1,1,1,0" BorderBrush="Gray" CornerRadius="3,3,0,0" Background="#FFEAEDF3">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <TextBlock FontSize="16" Foreground="{StaticResource TabItemHotTextBrush}" Margin="5,5,3,3" Text="{Binding Caption}" FontFamily="Microsoft Sans Serif"></TextBlock>
                </Grid>
            </Border>
        </DataTemplate>
    </localView:BeWoView.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <StackPanel Orientation="Horizontal" >
            <Label VerticalAlignment="Center" Content="Tag" />
            <ComboBox x:Name="comboDay" Height="23" Width="45"/>

            <Label VerticalAlignment="Center" Content="Monat" />
            <ComboBox x:Name="comboMonth" Height="23" Width="85"/>
            <Label VerticalAlignment="Center" Content="Jahr" />
            <ComboBox x:Name="comboYear" Height="23" Width="57"/>
            <!--<Label VerticalAlignment="Center" Margin="3" Height="23" Content="anz Tage" />
            <dxe:TextEdit x:Name="txtDayCount" Margin="3" Height="23" Width="40" Text="7"/>-->
            <Button x:Name="btnMoveLastWeek" FontFamily="Webdings" Content="3" Width="25" Margin="6,3,3,3" Click="ButtonLastWeek_Click" ToolTip="Vergangene Woche anzeigen"/>
            <Button x:Name="btnMoveNextWeek" FontFamily="Webdings" Content="4" Width="25" Margin="3" Click="ButtonNextWeek_Click" ToolTip="Nächste Woche anzeigen"/>

            <Button x:Name="btnShowMonth" Width="25" Margin="3" Click="ButtonShowMonth_Click" ToolTip="Ganzen Monat anzeigen">
                <Image Source="/BeWoPlaner;component/Ressources/Icons/Calendar31Day24.png" />
            </Button>
            <Button x:Name="btnShowWeek" Width="25" Margin="3" Click="ButtonShowWeek_Click" ToolTip="Ganzen Woche anzeigen" Visibility="Collapsed">
                <Image Source="/BeWoPlaner;component/Ressources/Icons/Calendar7Day24.png" />
            </Button>
        </StackPanel>

        <dxg:GridControl x:Name="grid" Margin="0,0,0,0" Grid.Row="1" >
            <dxg:GridControl.Resources>
                <ControlTemplate x:Key="display_asv">
                    <controls:AssessmentSheetValueControl Margin="3" Cursor="Hand" Focusable="True" AssessmetSheetValue="{Binding Value}"/>
                </ControlTemplate>
                <Style x:Key="highlightedCell" TargetType="dxg:CellContentPresenter">
                    <Setter Property="Background" Value="#9fbce3" />
                </Style>
                <conv:AssessmentSheetHeaderToForegroundConverter x:Key="ColorConverter" />
                </dxg:GridControl.Resources>
            <dxg:GridControl.Columns>
                <dxg:GridColumn x:Name="colCategory" FieldName="CategoryString" Header="Kategorie" Width="165"/>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day1" x:Name="colDay1" Header="1." Width="30" MinWidth="25" ></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day2" x:Name="colDay2" Header="2." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day3" x:Name="colDay3" Header="3." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day4" x:Name="colDay4" Header="4." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day5" x:Name="colDay5" Header="5." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day6" x:Name="colDay6" Header="6." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day7" x:Name="colDay7" Header="7." Width="30" MinWidth="25" ></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day8" x:Name="colDay8" Header="8." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day9" x:Name="colDay9" Header="9." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day10" x:Name="colDay10" Header="10." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day11" x:Name="colDay11" Header="11." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day12" x:Name="colDay12" Header="12." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day13" x:Name="colDay13" Header="13." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day14" x:Name="colDay14" Header="14." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day15" x:Name="colDay15" Header="15." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day16" x:Name="colDay16" Header="16." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day17" x:Name="colDay17" Header="17." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day18" x:Name="colDay18" Header="18." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day19" x:Name="colDay19" Header="19." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day20" x:Name="colDay20" Header="20." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day21" x:Name="colDay21" Header="21." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day22" x:Name="colDay22" Header="22." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day23" x:Name="colDay23" Header="23." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day24" x:Name="colDay24" Header="24." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day25" x:Name="colDay25" Header="25." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day26" x:Name="colDay26" Header="26." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day27" x:Name="colDay27" Header="27." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day28" x:Name="colDay28" Header="28." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day29" x:Name="colDay29" Header="29." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day30" x:Name="colDay30" Header="30." Width="30" MinWidth="25"></dxg:GridColumn>
                <dxg:GridColumn DisplayTemplate="{StaticResource display_asv}" FieldName="Day31" x:Name="colDay31" Header="31." Width="30" MinWidth="25"></dxg:GridColumn>
            </dxg:GridControl.Columns>

            <dxg:GridControl.View>
                <dxg:TableView x:Name="gridView" ShowIndicator="False" ShowHorizontalLines="False" AllowSorting="False" ShowVerticalLines="False" NavigationStyle="None" AllowMoving="False" AllowEditing="False" AutoWidth="False" IsColumnMenuEnabled="False" AllowColumnFiltering="False" ShowAutoFilterRow="False" ShowFilterPanelMode="Never" ShowGroupPanel="False" ShowGroupedColumns="false" ShowTotalSummary="False">
                   <dxg:TableView.ColumnHeaderTemplate>
                    <DataTemplate>
                        <Button Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dxg:GridColumnHeader}}}" Click="ColumnHeaderButton_Click" Height="18" >
                            <Button.Template>
                                <ControlTemplate TargetType="{x:Type Button}">
                                    <Grid SnapsToDevicePixels="True" Background="Transparent" Height="15">
                                        <TextBlock Text="{Binding}" Margin="2,0,2,0" Height="15">
                                            <TextBlock.Foreground>
                                                <MultiBinding Converter="{StaticResource ColorConverter}" >
                                                    <MultiBinding.Bindings>
                                                        <Binding RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type dxg:GridColumnHeader}}"/>
                                                        <Binding RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type dxg:GridControl}}" Path="DataContext" />
                                                        <Binding RelativeSource="{RelativeSource Mode=Self}" />
                                                    </MultiBinding.Bindings>
                                                </MultiBinding>
                                            </TextBlock.Foreground>
                                            
                                        </TextBlock>

                                    </Grid>
                                    <!--<ControlTemplate.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Fill" TargetName="path" Value="#FF00FF00" />
                                        </Trigger>
                                        <Trigger Property="IsPressed" Value="True">
                                            <Setter Property="Fill" TargetName="path" Value="#FFFF0000" />
                                        </Trigger>
                                    </ControlTemplate.Triggers>-->
                                </ControlTemplate>
                            </Button.Template>
                        </Button>
                    </DataTemplate>
                </dxg:TableView.ColumnHeaderTemplate>
                </dxg:TableView>
            </dxg:GridControl.View>
        </dxg:GridControl>

        <TextBlock Grid.Row="2" x:Name="textblock_link_pdfexport" VerticalAlignment="Center" Margin="5,6,5,3" HorizontalAlignment="Right" FontSize="14">
            <Hyperlink x:Name="linkPdfExport" TargetName="_NewWindow" Foreground="#FF2B508B" RequestNavigate="LinkPdfExport_OnRequestNavigate">
                <Run Text="Drucken" />
            </Hyperlink>
        </TextBlock>
        <Popup x:Name="popup_valuepicker" StaysOpen="false" Placement="MousePoint" Closed="popup_valuepicker_Closed">
            <ListBox x:Name="listbox_valuepicker" HorizontalContentAlignment="Stretch" BorderThickness="0">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown" Tag="{Binding}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Border Cursor="Hand" CornerRadius="3" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="#770424F9">
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                        <GradientStop Color="#00000000" Offset="0" />
                                        <GradientStop Color="#770424F9" Offset="1" />
                                    </LinearGradientBrush>
                                </Border.Background>
                            </Border>
                            <controls:AssessmentSheetValueControl IsHitTestVisible="False" Margin="3" Width="20" Height="20" Cursor="Hand" AssessmetSheetValue="{Binding}" />
                            <TextBlock Margin="3 3 6 3" Cursor="Hand" Grid.Column="1" VerticalAlignment="Center" Text="{Binding Description}" />
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Popup>
    </Grid>
</localView:BeWoView>