<mah:MetroWindow x:Class="ZKuP.ArrivalsOverview"
        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:mah="http://metro.mahapps.com/winfx/xaml/controls"
        xmlns:local="clr-namespace:ZKuP"
        mc:Ignorable="d"
        Title="Ankunftsübersicht" Height="750" Width="1300" Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">
    <mah:MetroWindow.Resources>
        <local:ConvertToBackground2 x:Key="ConvertToBackground2"></local:ConvertToBackground2>
    </mah:MetroWindow.Resources>
    <Grid>

        <DataGrid x:Name="dgArrivalsOverview" Margin="10,65,10,10" AutoGenerateColumns="False" ItemsSource="{Binding .}" CanUserDeleteRows="False" CanUserAddRows="False" RowHeaderWidth="0">
            <DataGrid.RowStyle>
                <Style TargetType="{x:Type DataGridRow}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Name, Converter={StaticResource ConvertToBackground2}}" Value="1">
                            <Setter Property="Background" Value="#3000FF00"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Name, Converter={StaticResource ConvertToBackground2}}" Value="0">
                            <Setter Property="Background" Value="#30FF0000"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.RowStyle>

            <DataGrid.Columns>

                <DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="*" SortDirection="Ascending">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="Margin" Value="4"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="Verantwortlicher Firma / Besucher" Binding="{Binding Verantwortlicher_MA_Firma}" Width="*">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="Margin" Value="4"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="Tel. Firma / Besucher" Binding="{Binding Tel_Nr_Verantwortlicher_Firma}" Width="140">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="Margin" Value="4"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="Ansprechpartner Intern" Binding="{Binding Ansprechpartner_Intern}" Width="140">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="Margin" Value="4"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="Auftrag" Binding="{Binding Beauftragte_Leistung}" Width="*">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="Margin" Value="4"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="Arbeitsbeginn" Binding="{Binding Arbeitsbeginn, StringFormat=\{0:dd.MM.yyyy\}}" Width="90">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="Margin" Value="4"/>
                            <Setter Property="TextAlignment" Value="Center"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Header="Arbeitsende" Binding="{Binding Arbeitsende, StringFormat=\{0:dd.MM.yyyy\}}" Width="90">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="Margin" Value="4"/>
                            <Setter Property="TextAlignment" Value="Center"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>
        <DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" x:Name="dPOverviewVon" HorizontalAlignment="Left" Margin="90,5,0,0" VerticalAlignment="Top" Width="100" SelectedDateChanged="dPOverviewVon_SelectedDateChanged" DateValidationError="dPOverviewVon_DateValidationError">
            <DatePicker.Resources>
                <Style TargetType="DatePickerTextBox">
                    <Setter Property="IsReadOnly" Value="True"/>
                    <Setter Property="Focusable" Value="False"/>
                    <Setter Property="IsEnabled" Value="False"/>
                    <Setter Property="Background" Value="{Binding ElementName=dPOverviewVon, Path=Background}"/>
                    <Setter Property="BorderBrush" Value="{Binding ElementName=dPOverviewBis, Path=Background}"/>
                    <Setter Property="TextAlignment" Value="Center"/>
                </Style>
            </DatePicker.Resources>
        </DatePicker>
        <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,14,0,0" TextWrapping="Wrap" Text="Ansicht von:" VerticalAlignment="Top" Height="20" Width="75"/>
        <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="200,14,0,0" TextWrapping="Wrap" Text="bis:" VerticalAlignment="Top" Height="20" Width="26"/>
        <DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" x:Name="dPOverviewBis" HorizontalAlignment="Left" Margin="230,5,0,0" VerticalAlignment="Top" Width="100" SelectedDateChanged="dPOverviewBis_SelectedDateChanged" DateValidationError="dPOverviewBis_DateValidationError">
            <DatePicker.Resources>
                <Style TargetType="DatePickerTextBox">
                    <Setter Property="IsReadOnly" Value="True"/>
                    <Setter Property="Focusable" Value="False"/>
                    <Setter Property="IsEnabled" Value="False"/>
                    <Setter Property="Background" Value="{Binding ElementName=dPOverviewBis, Path=Background}"/>
                    <Setter Property="BorderBrush" Value="{Binding ElementName=dPOverviewBis, Path=Background}"/>
                    <Setter Property="TextAlignment" Value="Center"/>
                </Style>
            </DatePicker.Resources>
        </DatePicker>
        <!--<Button x:Name="btnOK" Content="OK" IsEnabled="False" HorizontalAlignment="Left" Margin="345,10,0,0" VerticalAlignment="Top" Width="75" Height="24" Click="btnOK_Click"/>-->
        <TextBlock x:Name="lblAnwesend"  Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Text="Anwesende Firmen/Besucher zwischen dem '' und '':" HorizontalAlignment="Left" Margin="10,45,0,0" VerticalAlignment="Top"/>
    </Grid>
</mah:MetroWindow>
