<mah:MetroWindow
        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:local="clr-namespace:ZKuP"
        xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" x:Class="ZKuP.CreateFirma"
        mc:Ignorable="d"
        Title="Firmen verwalten" Height="682" Width="1378"
        WindowStartupLocation="CenterOwner" Closing="Window_Closing"  Loaded="Window_Loaded" LocationChanged="Window_LocationChanged">

    <mah:MetroWindow.Resources>
        <ResourceDictionary>
            <ControlTemplate x:Key="ComboBoxControlTemplate1" TargetType="{x:Type ComboBox}">
                <Grid x:Name="templateRoot" SnapsToDevicePixels="True">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
                    </Grid.ColumnDefinitions>
                    <Popup x:Name="PART_Popup" AllowsTransparency="True" Grid.ColumnSpan="2" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
                        <!--</Themes:SystemDropShadowChrome>-->
                        <!--<Themes:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=templateRoot}">-->
                        <Border x:Name="DropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
                            <ScrollViewer x:Name="DropDownScrollViewer">
                                <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
                                    <Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
                                        <Rectangle x:Name="OpaqueRect" Fill="{Binding Background, ElementName=DropDownBorder}" Height="{Binding ActualHeight, ElementName=DropDownBorder}" Width="{Binding ActualWidth, ElementName=DropDownBorder}"/>
                                    </Canvas>
                                    <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                </Grid>
                            </ScrollViewer>
                        </Border>
                    </Popup>
                    <ToggleButton x:Name="toggleButton" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
                        <ToggleButton.Style>
                            <Style TargetType="{x:Type ToggleButton}">
                                <Setter Property="OverridesDefaultStyle" Value="True"/>
                                <Setter Property="IsTabStop" Value="False"/>
                                <Setter Property="Focusable" Value="False"/>
                                <Setter Property="ClickMode" Value="Press"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                                            <Border x:Name="templateRoot" BorderBrush="#99ACACAC" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
                                                <Border.Background>
                                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                        <GradientStop Color="#99F0F0F0" Offset="0"/>
                                                        <GradientStop Color="#99FFFFFF" Offset="1"/>
                                                    </LinearGradientBrush>
                                                </Border.Background>
                                                <Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="True" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
                                                    <Path x:Name="Arrow" Data="F1M0,0L2.667,2.66665 5.3334,0 5.3334,-1.78168 2.6667,0.88501 0,-1.78168 0,0z" Fill="#CC000000" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/>
                                                </Border>
                                            </Border>
                                            <ControlTemplate.Triggers>
                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
                                                        <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/>
                                                        <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/>
                                                        <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/>
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="Background" TargetName="templateRoot" Value="White"/>
                                                    <Setter Property="BorderBrush" TargetName="templateRoot" Value="#4CABADB3"/>
                                                    <Setter Property="Background" TargetName="splitBorder" Value="Transparent"/>
                                                    <Setter Property="BorderBrush" TargetName="splitBorder" Value="Transparent"/>
                                                </MultiDataTrigger>
                                                <Trigger Property="IsMouseOver" Value="True">
                                                    <Setter Property="Fill" TargetName="Arrow" Value="Black"/>
                                                </Trigger>
                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
                                                        <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="false"/>
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="Background" TargetName="templateRoot">
                                                        <Setter.Value>
                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                <GradientStop Color="#4CECF4FC" Offset="0"/>
                                                                <GradientStop Color="#4CDCECFC" Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C7EB4EA"/>
                                                </MultiDataTrigger>
                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
                                                        <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="Background" TargetName="templateRoot" Value="White"/>
                                                    <Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C7EB4EA"/>
                                                    <Setter Property="Background" TargetName="splitBorder">
                                                        <Setter.Value>
                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                <GradientStop Color="#4CEBF4FC" Offset="0"/>
                                                                <GradientStop Color="#4CDCECFC" Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Setter Property="BorderBrush" TargetName="splitBorder" Value="#4C7EB4EA"/>
                                                </MultiDataTrigger>
                                                <Trigger Property="IsPressed" Value="True">
                                                    <Setter Property="Fill" TargetName="Arrow" Value="Black"/>
                                                </Trigger>
                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
                                                        <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="false"/>
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="Background" TargetName="templateRoot">
                                                        <Setter.Value>
                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                <GradientStop Color="#4CDAECFC" Offset="0"/>
                                                                <GradientStop Color="#4CC4E0FC" Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C569DE5"/>
                                                </MultiDataTrigger>
                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
                                                        <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="Background" TargetName="templateRoot" Value="White"/>
                                                    <Setter Property="BorderBrush" TargetName="templateRoot" Value="#4C569DE5"/>
                                                    <Setter Property="Background" TargetName="splitBorder">
                                                        <Setter.Value>
                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                <GradientStop Color="#4CDAEBFC" Offset="0"/>
                                                                <GradientStop Color="#4CC4E0FC" Offset="1"/>
                                                            </LinearGradientBrush>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Setter Property="BorderBrush" TargetName="splitBorder" Value="#4C569DE5"/>
                                                </MultiDataTrigger>
                                                <Trigger Property="IsEnabled" Value="False">
                                                    <Setter Property="Fill" TargetName="Arrow" Value="#4C000000"/>
                                                </Trigger>
                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
                                                        <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="false"/>
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="Background" TargetName="templateRoot" Value="#4CF0F0F0"/>
                                                    <Setter Property="BorderBrush" TargetName="templateRoot" Value="#4CD9D9D9"/>
                                                </MultiDataTrigger>
                                                <MultiDataTrigger>
                                                    <MultiDataTrigger.Conditions>
                                                        <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
                                                        <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ComboBox}}}" Value="true"/>
                                                    </MultiDataTrigger.Conditions>
                                                    <Setter Property="Background" TargetName="templateRoot" Value="White"/>
                                                    <Setter Property="BorderBrush" TargetName="templateRoot" Value="#4CBFBFBF"/>
                                                    <Setter Property="Background" TargetName="splitBorder" Value="Transparent"/>
                                                    <Setter Property="BorderBrush" TargetName="splitBorder" Value="Transparent"/>
                                                </MultiDataTrigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </ToggleButton.Style>
                    </ToggleButton>
                    <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="False" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                </Grid>
                <ControlTemplate.Triggers>
                    <!--<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="True">
                                <Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
                                <Setter Property="Color" TargetName="shadow" Value="#71000000"/>
                            </Trigger>-->
                    <Trigger Property="HasItems" Value="False">
                        <Setter Property="Height" TargetName="DropDownBorder" Value="95"/>
                    </Trigger>
                    <MultiTrigger>
                        <MultiTrigger.Conditions>
                            <Condition Property="IsGrouping" Value="True"/>
                            <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="False"/>
                        </MultiTrigger.Conditions>
                        <Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
                    </MultiTrigger>
                    <Trigger Property="CanContentScroll" SourceName="DropDownScrollViewer" Value="False">
                        <Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
                        <Setter Property="Canvas.Left" TargetName="OpaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
            
            <local:NullToVisibilityConverter x:Key="NullToVisibilityConverter"/>
        </ResourceDictionary>
    </mah:MetroWindow.Resources>


    <Grid x:Name="grid">
        <TextBox x:Name="tbName" HorizontalAlignment="Left" Height="23" Margin="10,57,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="1" PreviewKeyDown="TextBoxes_PreviewKeyDown" TextChanged="tbName_TextChanged" LostKeyboardFocus="tbName_LostFocus" LostFocus="tbName_LostFocus"/>
        <TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,36,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Name der Firma (Nur Firmenname, ohne Fa., Firma, etc...)"/></TextBlock>
        <TextBox x:Name="tbVerantwortlicher_MA" HorizontalAlignment="Left" Height="23" Margin="10,106,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="2" PreviewKeyDown="TextBoxes_PreviewKeyDown"/>
        <TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,85,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Verantwortlicher Mitarbeiter der Firma"/></TextBlock>
        <TextBox x:Name="tbTel_Firma" HorizontalAlignment="Left" Height="23" Margin="10,155,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="3" PreviewKeyDown="TextBoxes_PreviewKeyDown" PreviewTextInput="tbTel_Firma_PreviewTextInput"/>
        <TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,134,0,0" TextWrapping="Wrap" VerticalAlignment="Top"><Run Text="Telefonnummer Mitarbeiter der Firma"/></TextBlock>

        <StackPanel Margin="10,204,0,0" Width="340" HorizontalAlignment="Left" VerticalAlignment="Top" Orientation="Horizontal">
            <TextBox x:Name="tbAnzahl_Begleiter" HorizontalAlignment="Left" Width="170" Height="23" TextWrapping="Wrap" Text="" VerticalAlignment="Top" TabIndex="4" PreviewKeyDown="TextBoxes_PreviewKeyDown" PreviewTextInput="tbAnzahl_Begleiter_PreviewTextInput" ToolTip="Nur Zahlen und max. 2 Stellen" CommandManager.PreviewExecuted="Textboxes_PreviewExecuted" ContextMenu="{x:Null}"/>
            <Button x:Name="btnBegleiter" Content="Begleitpersonen angeben" Width="165" FontSize="12" Margin="5,0,0,0" HorizontalAlignment="Right" Click="btnBegleiter_Click"/>
        </StackPanel>
        
        <TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,183,0,0" TextWrapping="Wrap" Text="Anzahl Begleitpersonen" VerticalAlignment="Top"/>
        <TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,379,0,0" TextWrapping="Wrap" Text="Arbeitsbeginn ab" VerticalAlignment="Top"/>
        <TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" x:Name="lbl1" HorizontalAlignment="Left" Margin="10,429,0,0" TextWrapping="Wrap" Text="Personen in Baumaßnahme eingewiesen bis" VerticalAlignment="Top"/>
        <ComboBox x:Name="cbAnsprechpartner_Intern" HorizontalAlignment="Left" Height="23" Margin="10,553,0,0" Text="" VerticalAlignment="Top" Width="340" SelectionChanged="CbAnsprechpartner_Intern_SelectionChanged" TabIndex="16"/>
        <TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,532,0,0" TextWrapping="Wrap" Text="Ansprechpartner intern" VerticalAlignment="Top"/>
        <TextBox x:Name="tbTel_Nr_Ansprechpartner_Intern" HorizontalAlignment="Left" Height="23" Margin="10,602,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="14" PreviewKeyDown="TextBoxes_PreviewKeyDown" PreviewTextInput="tbTel_Nr_Ansprechpartner_Intern_PreviewTextInput"/>
        <TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,581,0,0" TextWrapping="Wrap" Text="Telefonnummer Ansprechpartner" VerticalAlignment="Top"/>
        <DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" x:Name="dpArbeitsbeginn" HorizontalAlignment="Left" Margin="10,400,0,0" VerticalAlignment="Top" TabIndex="8" PreviewKeyDown="DpArbeitsbeginn_PreviewKeyDown" IsTabStop="True" DateValidationError="dpArbeitsbeginn_DateValidationError"/>
        <DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" x:Name="dpEinweisung_Bis" HorizontalAlignment="Left" Margin="10,450,0,0" VerticalAlignment="Top" Width="340" TabIndex="10" IsTabStop="True" Focusable="True" PreviewKeyDown="DpEinweisung_Bis_PreviewKeyDown" DateValidationError="dpEinweisung_Bis_DateValidationError">
            <DatePicker.Resources>
                <Style x:Key="dpEinweisungStyle" TargetType="{x:Type DatePickerTextBox}">
                    <Setter Property="Text" Value="Datum auswählen                   →"/>
                    <Setter Property="IsReadOnly" Value="True"/>
                </Style>
            </DatePicker.Resources>

        </DatePicker>
        <ContentControl x:Name="ccBE" MouseEnter="cbBE_MouseEnter">
            <ComboBox x:Name="cbBE" IsEnabled="{Binding BEColumnIsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CreateFirma}}}" HorizontalAlignment="Left" Height="23" Margin="10,349,0,0" Text="" VerticalAlignment="Top" Width="340" TabIndex="7">
                <!--<ComboBoxItem Content=""          />
            <ComboBoxItem Content="BE-Fläche 1 (ICE-West/Containerburg)"/>
            <ComboBoxItem Content="BE-Fläche 2 (ICE-West/MaWi/Gleisabstellung)"/>
            <ComboBoxItem Content="BE-Fläche 4 (Aufgang Friedenheimer-Brücke)"/>
            <ComboBoxItem Content="BE-Fläche 6 (Lokhalle Gleisbereich Süd-Ost)"/>
            <ComboBoxItem Content="BE-Fläche 8 (Schichtparkplatz)"/>
            <ComboBoxItem Content="BE-Fläche 9 (Kantine)"/>
            <ComboBoxItem Content="BE-Fläche 10 (Gebäude G)"/>
            <ComboBoxItem Content="BE-Fläche 11 (Gaslager)"/>
            <ComboBoxItem Content="BE-Fläche 12 (Feuerwehrzufahrt Süd)"/>
            <ComboBoxItem Content="BE-Fläche 13 (Feuerwehrzufahrt Süd)"/>-->
            </ComboBox>
        </ContentControl>
        <TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Left" Margin="10,328,0,0" TextWrapping="Wrap" Text="Gebuchte BE-Fläche" VerticalAlignment="Top"/>



        <Button x:Name="btnAdd" Content="Hinzufügen&#xA;       →" HorizontalAlignment="Left" FontSize="12" Padding="-2" Margin="355,36,0,0" VerticalAlignment="Top" Width="75" Height="580" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Click="btnAdd_Click" TabIndex="15"/>
        <DataGrid x:Name="dgFirmen" Margin="435,36,10,43" KeyboardNavigation.TabNavigation="None" ItemsSource="{Binding ., Mode=OneWay}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserReorderColumns="False" IsTabStop="False" HorizontalScrollBarVisibility="Visible" CellEditEnding="DgFirmen_CellEditEnding" CanUserDeleteRows="False" PreviewKeyDown="DgFirmen_PreviewKeyDown" BeginningEdit="dgFirmen_BeginningEdit" SelectionMode="Single" PreparingCellForEdit="dgFirmen_PreparingCellForEdit">
            <DataGrid.RowStyle>
                <Style TargetType="{x:Type DataGridRow}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Örtliche_Einweisung_bis, StringFormat=\{0:dd.MM.yyyy\}}" Value="01.01.1902">
                            <Setter Property="Background" Value="Red"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Örtliche_Einweisung_bis, StringFormat=\{0:dd.MM.yyyy\}}" Value="01.01.1903">
                            <Setter Property="Background" Value="#CCFFA200"/>
                            <Setter Property="Foreground" Value="Black"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.RowStyle>
            <DataGrid.CellStyle>
                <!--Override Highlighting so that its easy to see what is selected even when the control is not focused-->
                <Style TargetType="{x:Type DataGridCell}">
                    <Style.Triggers>
                        <Trigger  Property="IsSelected" Value="true">
                            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
                            <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                        </Trigger>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="True" />
                                <Condition Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}, Mode=FindAncestor}}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
                            <Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                        </MultiDataTrigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.CellStyle>
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Name}" Width="200" ClipboardContentBinding="{x:Null}" Header="Name" SortDirection="Ascending">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="VerticalAlignment" Value="Center"/>
                            <Setter Property="Padding" Value="5,0,0,0"/>
                            <Setter Property="ToolTip" Value="Daten können per Doppelklick geändert werden"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding Verantwortlicher_MA_Firma}" Width="200" ClipboardContentBinding="{x:Null}" Header="Verantw. MA">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="VerticalAlignment" Value="Center"/>
                            <Setter Property="Padding" Value="5,0,0,0"/>
                            <Setter Property="ToolTip" Value="Daten können per Doppelklick geändert werden"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding Tel_Nr_Verantwortlicher_Firma}" Header="Tel. Firma">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="VerticalAlignment" Value="Center"/>
                            <Setter Property="Padding" Value="5,0,0,0"/>
                            <Setter Property="ToolTip" Value="Daten können per Doppelklick geändert werden"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <!--<DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Header="Tel. Firma">--><!--Binding="{Binding Tel_Nr_Verantwortlicher_Firma}"--><!--
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBox Text="{Binding Tel_Nr_Verantwortlicher_Firma}" Background="Transparent" BorderThickness="0" VerticalAlignment="Center" HorizontalAlignment="Left" HorizontalContentAlignment="Center" Padding="5" PreviewTextInput="tbTel_Firma_PreviewTextInput" LostKeyboardFocus="TelNrVerantwortlicher_LostKeyboardFocus">
                            </TextBox>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>-->
                
                <!--<DataGridTextColumn Binding="{Binding Anzahl_Begleiter}" ClipboardContentBinding="{x:Null}" Header="Anz. Begleitp.">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="TextAlignment" Value="Center"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>-->
                <DataGridTemplateColumn Header="Anz. Begleitp.">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
                                <TextBox x:Name="tbdgAnzBegleit" Text="{Binding Anzahl_Begleiter}" BorderThickness="0" Background="Transparent" Width="50" TextAlignment="Center" VerticalAlignment="Center" LostKeyboardFocus="TextBox_LostKeyboardFocus" GotKeyboardFocus="TextBox_GotKeyboardFocus"/>
                                <Button x:Name="btnEdit" Width="25" Height="25" ToolTip="Begleitpersonen bearbeiten/hinzufügen/entfernen" HorizontalAlignment="Right" Padding="0" Click="btnEdit_Click">
                                    <Button.Content>
                                        <Image Source="/Resources/Edit.png" Height="23"/>
                                    </Button.Content>
                                    <!--<Button.ContextMenu>
                                        <ContextMenu>
                                            <MenuItem Header="Anzahl ändern" Tag="1" Click="MenuItem_Click"/>
                                            <MenuItem Header="Personen anzeigen/bearbeiten" Tag="2" Click="MenuItem_Click"/>
                                        </ContextMenu>
                                    </Button.ContextMenu>-->
                                </Button>
                            </StackPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Binding="{Binding Anzahl_Fzg}" ClipboardContentBinding="{x:Null}" Header="Anz. Fzg.">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="TextAlignment" Value="Center"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding Beauftragte_Leistung}" ClipboardContentBinding="{x:Null}" Header="Beauftragte Leistung">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="VerticalAlignment" Value="Center"/>
                            <Setter Property="Padding" Value="5,0,0,0"/>
                            <Setter Property="ToolTip" Value="Daten können per Doppelklick geändert werden"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Header="Arbeitsbeginn" Width="100">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" x:Name="dpDataGridArbeitsbeginn" Width="98" SelectedDate="{Binding Arbeitsbeginn, StringFormat=\{0:dd.MM.yyyy\}}" ToolTip="Datum über Kalender ändern" CalendarOpened="dpDataGridArbeitsbeginn_CalendarOpened" CalendarClosed="dpDataGridArbeitsbeginn_CalendarClosed" DateValidationError="dpArbeitsbeginn_DateValidationError">
                                <DatePicker.Resources>
                                    <Style TargetType="{x:Type DatePickerTextBox}">
                                        <Setter Property="IsReadOnly" Value="True"/>
                                    </Style>
                                </DatePicker.Resources>
                            </DatePicker>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn ClipboardContentBinding="{x:Null}" Header="Arbeitsende" Width="100">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" x:Name="dpDataGridArbeitsende" Width="98" SelectedDate="{Binding Arbeitsende, StringFormat=\{0:dd.MM.yyyy\}}" ToolTip="Datum über Kalender ändern" CalendarOpened="dpDataGridArbeitsende_CalendarOpened" CalendarClosed="dpDataGridArbeitsende_CalendarClosed" DateValidationError="dpArbeitsende_DateValidationError">
                                <DatePicker.Resources>
                                    <Style TargetType="{x:Type DatePickerTextBox}">
                                        <Setter Property="IsReadOnly" Value="True"/>
                                    </Style>
                                </DatePicker.Resources>
                            </DatePicker>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <!--<DataGridTextColumn Binding="{Binding Arbeitsbeginn, StringFormat=\{0:dd.MM.yyyy\}}" ClipboardContentBinding="{x:Null}" Header="Arbeitsbeginn">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="TextAlignment" Value="Center"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
                <DataGridTextColumn Binding="{Binding Arbeitsende, StringFormat=\{0:dd.MM.yyyy\}}" ClipboardContentBinding="{x:Null}" Header="Arbeitsende">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="TextAlignment" Value="Center"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>-->
                <DataGridTemplateColumn Header="Unterwiesen bis">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" x:Name="dpDataGridEinweisung" Width="98" SelectedDate="{Binding Örtliche_Einweisung_bis, StringFormat=\{0:dd.MM.yyyy\}}" ToolTip="Datum über Kalender ändern" CalendarOpened="dpDataGridEinweisung_CalendarOpened" CalendarClosed="dpDataGridEinweisung_CalendarClosed" DateValidationError="dpEinweisung_Bis_DateValidationError">
                                    <DatePicker.Resources>
                                        <Style TargetType="{x:Type DatePickerTextBox}">
                                            <Setter Property="IsReadOnly" Value="True"/>
                                        </Style>
                                    </DatePicker.Resources>
                                </DatePicker>
                                <StackPanel Orientation="Vertical">
                                    <StackPanel Orientation="Horizontal">
                                        <Button x:Name="btnDpDgEinweisungWoche" Width="20" Height="17" Content="W" FontSize="12" Padding="-2" Foreground="Black" ToolTip="Unterweisung: Heute + 1 Woche" ToolTipOpening="btnDpDgEinweisung_ToolTipOpening" Click="btnDpDgEinweisung_Click"/>
                                        <Button x:Name="btnDpDgEinweisungMonat" Width="20" Height="17" Content="M" FontSize="12" Padding="-2" Foreground="Black" ToolTip="Unterweisung: Heute + 1 Monat" ToolTipOpening="btnDpDgEinweisung_ToolTipOpening" Click="btnDpDgEinweisung_Click"/>
                                        <Button x:Name="btnDpDgEinweisungJahr" Width="20" Height="17" Content="J" FontSize="12" Padding="-2" Foreground="Black" ToolTip="Unterweisung: Heute + 1 Jahr" ToolTipOpening="btnDpDgEinweisung_ToolTipOpening" Click="btnDpDgEinweisung_Click"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <Button x:Name="btnDpDgEinweisungFolgt" Width="30" Height="17" Content="Folgt" FontSize="12" Padding="-2" Foreground="Black" Background="#FFFF9191" ToolTip="Einweisung folgt" Click="btnDpDgEinweisung_Click"/>
                                        <Button x:Name="btnDpDgEinweisungBegleitung" Width="30" Height="17" Content="Begl." FontSize="12" Padding="-2" Foreground="Black" Background="#CCFFA200" ToolTip="Nur in Begleitung" Click="btnDpDgEinweisung_Click"/>
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Header="BE-Fläche" MinWidth="150">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Grid x:Name="grid_dgBE" MouseEnter="cbBE_MouseEnter">
                                <TextBlock Text="{Binding BE, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Visibility="{Binding BE, Converter={StaticResource NullToVisibilityConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4,0,0,0"/>
                                <ComboBox x:Name="dg_cbBE" IsEnabled="{Binding BEColumnIsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CreateFirma}}}" Template="{StaticResource ComboBoxControlTemplate1}" ItemsSource="{Binding BEItems, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CreateFirma}}}" SelectedItem="{Binding BE, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" DropDownClosed="dg_cbBE_DropDownClosed" DropDownOpened="dg_cbBE_DropDownOpened">
                                    <!--SelectedItem="{Binding BE, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" -->
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding}"/>
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>
                            </Grid>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <!--<DataGridTextColumn Binding="{Binding Ansprechpartner_Intern}" ClipboardContentBinding="{x:Null}" Header="Anspr. intern"/>-->
                <DataGridTemplateColumn Header="Anspr. intern" MinWidth="150">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <ComboBox x:Name="dg_cbASP" Template="{StaticResource ComboBoxControlTemplate1}" ItemsSource="{Binding asp, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:CreateFirma}}}" SelectedItem="{Binding Ansprechpartner_Intern, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" DropDownClosed="dg_cbAsp_DropDownClosed" DropDownOpened="dg_cbASP_DropDownOpened">
                                <ComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding}"/>
                                    </DataTemplate>
                                </ComboBox.ItemTemplate>
                            </ComboBox>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Binding="{Binding Tel_Nr_Ansprechpartner_Intern}" ClipboardContentBinding="{x:Null}" Header="Tel. Ansprechp.">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="VerticalAlignment" Value="Center"/>
                            <Setter Property="Padding" Value="5,0,0,0"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>
            </DataGrid.Columns>
        </DataGrid>

        <Button x:Name="btnClose" Content="Schließen" FontSize="12" Padding="-2" Margin="0,0,10,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="98" Height="28" Click="BtnClose_Click" TabIndex="16"/>
        <TextBox x:Name="tbAnzahl_Fzg" HorizontalAlignment="Left" Height="23" Margin="10,253,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="5" PreviewKeyDown="TextBoxes_PreviewKeyDown" PreviewTextInput="tbAnzahl_Fzg_PreviewTextInput" ToolTip="Nur Zahlen und max. 2 Stellen" CommandManager.PreviewExecuted="Textboxes_PreviewExecuted" ContextMenu="{x:Null}"/>
        <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,232,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Text="Anzahl Fahrzeuge"/>
        <TextBox x:Name="tbBeauftragte_Leistung" HorizontalAlignment="Left" Height="23" Margin="10,302,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="340" TabIndex="6" PreviewKeyDown="TbBeauftragte_Leistung_PreviewKeyDown"/>
        <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="10,281,0,0" TextWrapping="Wrap" Text="Beauftragte Leistung" VerticalAlignment="Top"/>
        <TextBlock HorizontalAlignment="Left" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Margin="170,379,0,0" TextWrapping="Wrap" Text="Arbeitsende bis" VerticalAlignment="Top"/>
        <DatePicker local:DatePickerHelper.ShowTodayButton="True" local:DatePickerHelper.ShowTodayButtonContent="Heute" x:Name="dpArbeitsende" HorizontalAlignment="Left" Margin="170,400,0,0" VerticalAlignment="Top" TabIndex="9" PreviewKeyDown="DpArbeitsende_PreviewKeyDown" IsTabStop="True" DateValidationError="dpArbeitsende_DateValidationError"/>
        <Button x:Name="btnEinweisung_1Jahr" Content="↑  Für ein Jahr"  FontSize="12" Padding="-2" HorizontalAlignment="Left" Margin="245,477,0,0" VerticalAlignment="Top" Width="105" Click="BtnEinweisung_PreValues_Click" Height="24" TabIndex="13" ToolTip="Firma hat bereits eine Einweisung bekommen&#xA;Ablauf in einem Jahr wird automatisch eingetragen"/>
        <Button x:Name="btnEinweisung_1Monat" Content="↑  Für einen Monat" FontSize="12" Padding="-2" HorizontalAlignment="Left" Margin="124,477,0,0" VerticalAlignment="Top" Width="116" Click="BtnEinweisung_PreValues_Click" Height="24" TabIndex="12" ToolTip="Firma hat bereits eine Einweisung bekommen&#xA;Ablauf in einem Monat wird automatisch eingetragen"/>
        <Button x:Name="btnEinweisung_1Woche" Content="↑  Für eine Woche" FontSize="12" Padding="-2" HorizontalAlignment="Left" Margin="10,477,0,0" VerticalAlignment="Top" Width="109" Click="BtnEinweisung_PreValues_Click" Height="24" TabIndex="11" ToolTip="Firma hat bereits eine Einweisung bekommen&#xA;Ablauf in einer Woche wird automatisch eingetragen"/>
        <Button x:Name="btnEinweisungFolgt" Content="↑  Einweisung folgt" FontSize="12" Padding="-2" HorizontalAlignment="Left" Margin="10,503,0,0" VerticalAlignment="Top" Width="165" Height="24" TabIndex="14" Click="BtnEinweisung_PreValues_Click" BorderBrush="#FFF50707" Background="#FFFF9191" ToolTip="Für Firmen die eine Einweisung (durch Projektleiter oä.) bekommen, aber bis jetzt keine haben"/>
        <Button x:Name="btnDelete" Content="Markierte Firma löschen" FontSize="12" Padding="-2" Margin="0,10,10,0" Height="23" VerticalAlignment="Top" HorizontalAlignment="Right" Width="187" Click="btnDelete_Click" IsEnabled="False"/>
        <Button x:Name="btnBegleitung" Content="↑  Nur in Begleitung" FontSize="12" Padding="-2" HorizontalAlignment="Left" Margin="180,503,0,0" VerticalAlignment="Top" Width="170" Height="24" Background="#CCFFA200" BorderBrush="#FFFF8B00" Click="BtnEinweisung_PreValues_Click" ToolTip="Für Fimen die sich nur in Begleitung auf dem Gelände bewegen dürfen" TabIndex="15"/>
        <Button x:Name="btnHelp" Content="Hilfe zur Tabelle" FontSize="12" Padding="-2" HorizontalAlignment="Left" Margin="435,11,0,0" Height="23" VerticalAlignment="Top" Width="160" Click="btnHelp_Click"/>

        <Popup PopupAnimation="Fade" AllowsTransparency="True" Width="250" StaysOpen="False" x:Name="M2WithGebuchterBETooltipPopup" Closed="TooltipPopup_Closed">
            <Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="LightGray" CornerRadius="3" BorderThickness="1">
                <StackPanel Margin="0" Orientation="Vertical" >
                    <TextBlock Text="Gebuchte BE-Fläche wählen" Margin="5" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Center"/>
                    <TextBlock Text="oder" HorizontalAlignment="Center" Margin="5" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                    <Border BorderBrush="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderThickness="1" CornerRadius="3">
                        <Button Content="Zur Buchung" HorizontalAlignment="Stretch" Margin="0,5,0,0" Click="GoToBEBuchung_Click" VerticalAlignment="Bottom" />
                    </Border>
                </StackPanel>
            </Border>
        </Popup>

        <Popup PopupAnimation="Fade" AllowsTransparency="True"  StaysOpen="False" x:Name="M2WithoutGebuchterBETooltipPopup" Closed="TooltipPopup_Closed">
            <Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="LightGray" CornerRadius="3" BorderThickness="1">
                <StackPanel Margin="0" Orientation="Vertical" >
                    <TextBlock Text="Keine gebuchten BE-Flächen vorhanden" Margin="5" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" HorizontalAlignment="Center"/>
                    <Border BorderBrush="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderThickness="1" CornerRadius="3">
                        <Button Content="Zur Buchung" HorizontalAlignment="Stretch" Margin="0,5,0,0" Click="GoToBEBuchung_Click" VerticalAlignment="Bottom" />
                    </Border>
                </StackPanel>
            </Border>
        </Popup>

        <Popup PopupAnimation="Fade" AllowsTransparency="True" StaysOpen="False" x:Name="NotM2TooltipPopup" Closed="TooltipPopup_Closed">
            <Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="LightGray" CornerRadius="3" BorderThickness="1">
                <StackPanel Margin="10" Orientation="Vertical" >
                    <TextBlock Text="BE-Flächen können nur von M2 gebucht werden" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                </StackPanel>
            </Border>
        </Popup>

        <Canvas x:Name="canvasHelp"  Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" HorizontalAlignment="Center" Height="370" Margin="0" VerticalAlignment="Center" Width="600" Visibility="Collapsed">
            <RichTextBox Height="350" Canvas.Left="10" Canvas.Top="10" Width="580" Background="{x:Null}" IsReadOnlyCaretVisible="True" Focusable="False" AllowDrop="False">
                <FlowDocument>
                    <Paragraph>
                        <Run Text="Erklärung zur Tabelle:"/>
                    </Paragraph>
                    <Paragraph LineHeight="6">
                        <Run Text="Daten in der Tabelle können per Doppelklick geändert werden."/>
                    </Paragraph>
                    <Paragraph LineHeight="6">
                        <Run Text="Änderungen werden mit ENTER oder Klick auf ein anderes Feld bestätigt."/>
                    </Paragraph>
                    <Paragraph LineHeight="6">
                        <Run Text="Falls eine Firma in der Vergangenheit bereits angelegt wurde, muss diese nicht erneut angelegt werden,"/>
                    </Paragraph>
                    <Paragraph LineHeight="6">
                        <Run Text="sondern es können die entsprechenden Daten direkt in der Tabelle geändert werden."/>
                    </Paragraph>
                    <Paragraph LineHeight="6">
                        <Run/>
                    </Paragraph>
                    <Paragraph LineHeight="6">
                        <Run Foreground="Red" Text="Rote Zeilen "/>
                        <Run Text=" "/>
                        <Run Text="stehen für Einträge die mit &quot;Einweisung folgt&quot; angelegt wurden"/>
                    </Paragraph>
                    <Paragraph LineHeight="6" Margin="20,Auto,Auto,Auto">
                        <Run Foreground="Red" Text="Bei diesen Einträgen muss das Einweisungsdatum nach erfolgter Einweisung eingetragen werden!"/>
                    </Paragraph>
                    <Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto">
                        <Run Text="Das Datum &quot;01.01.1902&quot; in der Spalte &quot;Unterwiesen bis&quot; steht für &quot;Einweisung folgt&quot;"/>
                    </Paragraph>
                    <Paragraph LineHeight="6" Margin="20,Auto,Auto,Auto">
                        <Run Foreground="Red"/>
                    </Paragraph>
                    <Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto">
                        <Run Foreground="#FFFFB533" Text="Gelbe Zeilen "/>
                        <Run Text=" "/>
                        <Run Text="stehen für Einträge die mit &quot;Nur in Begleitung&quot; angelegt wurden"/>
                    </Paragraph>
                    <Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto" TextIndent="20">
                        <Run Text="  "/>
                        <Run Text=" "/>
                        <Run Foreground="Red" Text="Diese Firmen dürfen sich nur in Begleitung eines internen MA auf dem Gelände bewegen!"/>
                    </Paragraph>
                    <Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto">
                        <Run Text="Das Datum &quot;01.01.1903&quot; in der Spalte &quot;Unterwiesen bis&quot; steht für &quot;Nur in Begleitung&quot;"/>
                    </Paragraph>
                    <Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto">
                        <Run/>
                    </Paragraph>
                    <Paragraph LineHeight="6" Margin="0,Auto,Auto,Auto">
                        <Run Foreground="Red" Text="Änderungen werden in der Datenbank protokolliert!!"/>
                    </Paragraph>
                </FlowDocument>
            </RichTextBox>
            <Button x:Name="btnCloseHelp" Content="Schließen" Width="96" HorizontalAlignment="Right" VerticalAlignment="Bottom" Canvas.Left="494" Canvas.Top="340" Click="btnCloseHelp_Click"/>
        </Canvas>

        <TextBlock x:Name="lblSearch" HorizontalAlignment="Left" Margin="625,15,0,0" TextWrapping="Wrap" Text="Suchen..." VerticalAlignment="Top" Height="16" Width="177" Foreground="Gray" Visibility="Visible"/>
        <TextBox x:Name="tbSearch" HorizontalAlignment="Left" Margin="618,11,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="182" Height="23" TextChanged="TextBox_TextChanged" Background="Transparent" Visibility="Visible"/>


        <mah:ProgressRing x:Name="searchProgress" HorizontalAlignment="Left" Margin="807,11,0,0" VerticalAlignment="Top" Height="23" Width="23" IsActive="True" Visibility="Collapsed"/>


    </Grid>
</mah:MetroWindow>
