<mah:MetroWindow x:Class="ZKuP.Delivery"
        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="Lieferant" Height="660" Width="500" MinHeight="620"  Loaded="Window_Loaded" LocationChanged="Window_LocationChanged" Visibility="Collapsed">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="0.8*"/>
            <RowDefinition Height="1.4*"/>
        </Grid.RowDefinitions>
        <TextBlock x:Name="lblFiltern" Margin="10,10,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" Text="Lieferantenliste filtern:" VerticalAlignment="Top"/>
        <TextBox x:Name="tbFilter" mah:TextBoxHelper.Watermark="Firma, Name, Fahrer, Kennzeichen oder ID" Margin="10,0,0,0" TextWrapping="Wrap" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="255" KeyDown="tbFilter_KeyDown"/>
        <Button x:Name="btnFiltern" Content="Filtern" FontSize="12" Padding="-2" Height="26" Margin="270,35,10,0" Click="btnFiltern_Click"/>

        <StackPanel x:Name="spLieferfirma" Grid.Row="1">
            <TextBlock x:Name="lblHinterlegt" Margin="12,10,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" VerticalAlignment="Top" Text="Hinterlegte Lieferanten:"/>
            <ComboBox x:Name="cBLieferfirma" Margin="10,0" Height="21" VerticalAlignment="Bottom" SelectionChanged="cBLieferfirma_SelectionChanged">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <Grid Width="{Binding ActualWidth, ElementName=cBLieferfirma, Mode=OneWay}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50"/>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="80"/>
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Text="{Binding ID}" Padding="5,2" FontWeight="Normal" Foreground="LightGray"/>
                            <TextBlock Grid.Column="1" Text="{Binding Firma}" Padding="5,2" FontWeight="Bold"/>
                            <TextBlock Grid.Column="2" Text="{Binding Fahrer}" Padding="5,2" FontWeight="Bold" Foreground="Gray"/>
                            <TextBlock Grid.Column="3" Text="{Binding Kennzeichen}" Padding="5,2"/>
                        </Grid>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </StackPanel>

        <StackPanel x:Name="spEntstoerdienst" Grid.Row="1" Visibility="Collapsed">
            <TextBlock x:Name="lblEntstoerdienst" Margin="12,10,10,0" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TextWrapping="Wrap" VerticalAlignment="Top" Text="Hinterlegte DB Firma:"/>
            <ComboBox x:Name="cBEntstoerdienste" Margin="10,0" Height="21" VerticalAlignment="Bottom" SelectionChanged="cBEntstoerdienste_SelectionChanged">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <Grid Width="{Binding ActualWidth, ElementName=cBLieferfirma, Mode=OneWay}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50"/>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="80"/>
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Text="{Binding ID}" Padding="5,2" FontWeight="Normal" Foreground="LightGray"/>
                            <TextBlock Grid.Column="1" Text="{Binding Firma}" Padding="5,2" FontWeight="Bold"/>
                            <TextBlock Grid.Column="2" Text="{Binding Fahrer}" Padding="5,2" FontWeight="Bold" Foreground="Gray"/>
                            <TextBlock Grid.Column="3" Text="{Binding Kennzeichen}" Padding="5,2"/>
                        </Grid>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </StackPanel>


        <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,0,0" TextWrapping="Wrap" Text="Firma:" VerticalAlignment="Top" Grid.Row="2"/>
        <TextBox x:Name="tbFirma" Margin="10,31,10,0" TextWrapping="Wrap" Padding="2" Grid.Row="2" PreviewKeyDown="TextBoxes_PreviewKeyDown" TextChanged="tbFirma_TextChanged"/>
        <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,0,0" Grid.Row="3" TextWrapping="Wrap" Text="Fahrername:" VerticalAlignment="Top"/>
        <TextBox x:Name="tbFahrer" Margin="10,31,10,0" Grid.Row="3" TextWrapping="Wrap" Padding="3" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
        <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,0,0" Grid.Row="4" TextWrapping="Wrap" Text="Handynummer:" VerticalAlignment="Top"/>
        <TextBox x:Name="tbHandy" Margin="10,31,10,0" Grid.Row="4" TextWrapping="Wrap" Padding="2" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
        <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,0,0" Grid.Row="5" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Kennzeichen:"/></TextBlock>
        <TextBox x:Name="tbKennzeichen" Margin="10,31,10,0" Grid.Row="5" TextWrapping="Wrap" Padding="2" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
        <!--<TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,0,0" Grid.Row="6" TextWrapping="Wrap" Text="Parkplatz:" VerticalAlignment="Top"/>
        <TextBox x:Name="tbParkplatz" Margin="10,31,10,0" Grid.Row="6" TextWrapping="Wrap" Padding="2" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>-->
        <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,10,0,0" Grid.Row="6" TextWrapping="Wrap" Text="Bemerkung:" VerticalAlignment="Top"/>
        <TextBox x:Name="tbBemerkung" Margin="10,35,10,10" Grid.Row="6" TextWrapping="Wrap" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>

        <Button x:Name="btnSignature" Content="Unterschrift" Margin="5,5" Grid.Row="7" Click="btnSignature_Click"/>

        <Grid x:Name="gridButtons" HorizontalAlignment="Stretch" Grid.Row="8" Margin="3" IsEnabled="False">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <Button x:Name="btnAddLKWLang" Padding="1" HorizontalAlignment="Stretch" Margin="2,5" Grid.Column="0" Grid.Row="9" Click="btnAdd_Click" ToolTipService.ShowOnDisabled="True" ToolTipService.InitialShowDelay="0">
                <Button.Content>
                    <StackPanel Orientation="Vertical">
                        <Image x:Name="imgLKWLang" Source="/Resources/LKWLang_button.png" ToolTip="Unterschrift erforderlich" ToolTipService.InitialShowDelay="100" ToolTipService.ShowOnDisabled="True" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="100" Height="45"/>
                        <TextBlock Text="LKW &gt; 7,5t" HorizontalAlignment="Center"/>
                    </StackPanel>
                </Button.Content>
            </Button>
            <Button x:Name="btnAddLKW" Padding="1" HorizontalAlignment="Stretch" Margin="2,5" Grid.Column="1" Grid.Row="9" Click="btnAdd_Click" ToolTipService.ShowOnDisabled="True" ToolTipService.InitialShowDelay="0">
                <Button.Content>
                    <StackPanel Orientation="Vertical">
                        <Image x:Name="imgLKW" Source="/Resources/LKW_button.png" ToolTip="Unterschrift erforderlich" ToolTipService.InitialShowDelay="100" ToolTipService.ShowOnDisabled="True" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="70" Height="45"/>
                        <TextBlock Text="LKW &lt; 7,5t" HorizontalAlignment="Center"/>
                    </StackPanel>
                </Button.Content>
            </Button>
            <Button x:Name="btnAddSprinter" Padding="1" HorizontalAlignment="Stretch" Margin="2,5" Grid.Column="2" Grid.Row="9" Click="btnAdd_Click" ToolTipService.ShowOnDisabled="True" ToolTipService.InitialShowDelay="0">
                <Button.Content>
                    <StackPanel Orientation="Vertical">
                        <Image x:Name="imgSprinter" Source="/Resources/Sprinter_button.png" ToolTip="Unterschrift erforderlich" ToolTipService.InitialShowDelay="100" ToolTipService.ShowOnDisabled="True" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="70" Height="45"/>
                        <TextBlock Text="Sprinter" HorizontalAlignment="Center"/>
                    </StackPanel>
                </Button.Content>
            </Button>
            <Button x:Name="btnAddPKW" Padding="1" HorizontalAlignment="Stretch" Margin="2,5" Grid.Column="3" Grid.Row="9" Click="btnAdd_Click" ToolTipService.ShowOnDisabled="True" ToolTipService.InitialShowDelay="0">
                <Button.Content>
                    <StackPanel Orientation="Vertical">
                        <Image x:Name="imgPKW" Source="/Resources/PKW_button.png" ToolTip="Unterschrift erforderlich" ToolTipService.InitialShowDelay="100" ToolTipService.ShowOnDisabled="True" Grid.Column="1" Grid.Row="1" Stretch="Fill" Width="70" Height="45"/>
                        <TextBlock Text="PKW" HorizontalAlignment="Center"/>
                    </StackPanel>
                </Button.Content>
            </Button>
        </Grid>


        <local:PopupNonTopmost x:Name="popupParkplatz" Topmost="False" IsOpen="False" Width="700" Height="350" AllowsTransparency="True" Placement="Right" HorizontalOffset="20" VerticalOffset="200" PlacementTarget="{Binding DataContext, ElementName=popBE}" PopupAnimation="Slide">
            <Grid Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
                <TextBlock x:Name="tbParkplatzHinweis" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10" FontSize="18"/>

                <Image x:Name="imgParkplatz" Source="/Assets/Parkplatz/01.png" VerticalAlignment="Top" Margin="0,50,0,0"/>
                <Image x:Name="imgEnergie" Source="/Assets/Parkplatz/34.png" Visibility="Collapsed" VerticalAlignment="Bottom"/>

            </Grid>
        </local:PopupNonTopmost>
        
    </Grid>
</mah:MetroWindow>
