<UserControl x:Class="BeWo.View.Controls.ServiceRecordPopUp"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:localViewModel="clr-namespace:BeWo.ViewModel">
  
        <Grid>
            <TextBlock Name="tb_nodata" Background="White" Padding="20" Text="Keine Eintragungen vorhanden"
                    Foreground="Black" FontSize="14"  />
            <ListBox ItemsSource="{Binding}" ScrollViewer.CanContentScroll="True" x:Name="serviceRecordGrid" Grid.Row="0"
                    Grid.Column="1" IsSynchronizedWithCurrentItem="True" TabIndex="1" AlternationCount="-1"
                    Background="{x:Null}" ItemTemplate="{DynamicResource serviceRecordListBoxItemTemplate}"
                    Style="{DynamicResource ServiceRecordListStyle}" HorizontalContentAlignment="Stretch"
                    ItemContainerStyle="{DynamicResource serviceRecordListBoxItemStyle}" >
                <ListBox.Resources>
                    <ControlTemplate x:Key="ServiceRecordListBoxTemplate" TargetType="{x:Type ListBox}">
                        <Border x:Name="Bd" SnapsToDevicePixels="True" Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}">
                            <ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}"
                                    HorizontalScrollBarVisibility="Disabled">
                                <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </ScrollViewer>
                        </Border>
                    </ControlTemplate>
                    <Style x:Key="ServiceRecordListStyle" TargetType="{x:Type ListBox}">
                        <Setter Property="Template" Value="{StaticResource ServiceRecordListBoxTemplate}" />
                        <Setter Property="Padding" Value="2,0,2,2" />
                    </Style>
                    <Style x:Key="serviceRecordListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
                        <Setter Property="Background" Value="#00FFFFFF" />
                        <Setter Property="HorizontalContentAlignment"
                                Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}" />
                        <Setter Property="VerticalContentAlignment"
                                Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}" />
                        <Setter Property="Padding" Value="2,0,0,0" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                    <Border x:Name="Bd" SnapsToDevicePixels="True" Background="{TemplateBinding Background}"
                                            BorderBrush="{TemplateBinding BorderBrush}"
                                            BorderThickness="{TemplateBinding BorderThickness}"
                                            Padding="{TemplateBinding Padding}">
                                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                Content="{TemplateBinding Content}"
                                                ContentStringFormat="{TemplateBinding ContentStringFormat}"
                                                ContentTemplate="{TemplateBinding ContentTemplate}" />
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsEnabled" Value="False">
                                            <Setter Property="Foreground"
                                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                    <DataTemplate x:Key="serviceRecordListBoxItemTemplate" DataType="{x:Type localViewModel:ServiceRecordVM}">
                        <Grid x:Name="template" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                            <Border x:Name="ItemBorder" CornerRadius="4,4,4,4" Width="Auto" Height="Auto" Padding="6"
                                    Margin="0,0,0,3" Background="{Binding Path=BackgroundBrush}" BorderThickness="1,1,1,1"
                                    BorderBrush="#FF7E7E7E">
                                <Grid TextBlock.Foreground="{Binding Path=TextBlock.Foreground, RelativeSource={RelativeSource TemplatedParent}}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="12" />
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="12" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="17" />
                                        <RowDefinition Height="14" />
                                        <RowDefinition Height="14" />
                                        <RowDefinition Height="14" />
                                        <RowDefinition Height="14" />
                                        <RowDefinition Height="14" />
                                        <RowDefinition Height="24" />
                                    </Grid.RowDefinitions>
                                    <TextBlock Grid.Column="0" Grid.Row="1" Text="Minuten (gerundet):" />
                                    <TextBlock Grid.Column="0" Grid.Row="2" Text="Leistungskategorie:" />
                                    <TextBlock Grid.Column="0" Grid.Row="3" Text="Leistung:" />
                                    <TextBlock Grid.Column="0" Grid.Row="4" Text="Angelegt von:" />
                                    <TextBlock Grid.Column="0" Grid.Row="5" Text="Angelegt am:" />
                                    <TextBlock Grid.Column="0" Grid.Row="0" Text="{Binding Path=LongDateString}"
                                            Grid.ColumnSpan="5" FontWeight="Bold" FontSize="13" Foreground="#FF494949" />
                                    <TextBlock Grid.Column="2" Grid.Row="1" Text="{Binding Path=DurationAndRoundedDuration}"
                                            FontWeight="Bold" Background="{x:Null}" Foreground="#FF4E7BC4" />
                                    <TextBlock Grid.Column="2" Grid.Row="2" Text="{Binding Path=Category}" />
                                    <TextBlock Grid.Column="2" Grid.Row="3" Text="{Binding Path=ServiceDescription}" />
                                    <TextBlock Grid.Column="2" Grid.Row="4" Text="{Binding Path=EmployeeName}" />
                                    <TextBlock Grid.Column="2" Grid.Row="5" Text="{Binding Path=InsertedOn}" />
                                    
                                    
                                    <TextBox Grid.Column="4" Grid.Row="1" Grid.RowSpan="6" HorizontalAlignment="Stretch"
                                            Text="{Binding Path=Notice}" HorizontalScrollBarVisibility="Hidden"
                                            VerticalScrollBarVisibility="Auto" Margin="0,0,0,0" BorderThickness="0"
                                            BorderBrush="{x:Null}" Background="{x:Null}" SnapsToDevicePixels="True"
                                            MaxHeight="200" TextWrapping="Wrap" AutoWordSelection="True" IsReadOnly="True"
                                            Tag="{Binding}" IsEnabled="True" Focusable="True" />
                                </Grid>
                            </Border>
                        </Grid>
                        <DataTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" TargetName="ItemBorder"
                                        Value="{Binding Path=MouseOverBackgroundBrush}" />
                            </Trigger>
                            
                        </DataTemplate.Triggers>
                    </DataTemplate>
                </ListBox.Resources>
            </ListBox>
        </Grid>
</UserControl>