<Window x:Class="BeWo.View.Detail.MailMergeWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:detail="clr-namespace:BeWo.View.Detail"
        xmlns:conv="clr-namespace:BeWo.Converter" 
        WindowStyle="None"
        AllowsTransparency="True"
        Background="Transparent"
        Title="MailMergeWindow" Height="530" Width="750" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" x:Name="SerienbriefFenster">
    <Window.Resources>
        <!-- Region HilfeplanTemplate -->
        <Style x:Key="SupportConceptMailMergeDetailStyle" TargetType="{x:Type ListBoxItem}">
            <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}" />
            <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}" />
            <Setter Property="Margin" Value="0,2,0,0" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Grid x:Name="PART_DeinGridIstNichtMeinGridIstMeinUngrid">
                            <Border x:Name="ItemBorder" CornerRadius="5" MinHeight="30" Background="#FF000000">
                                <Border.OpacityMask>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#19000000" Offset="0" />
                                        <GradientStop Color="#26000000" Offset="1" />
                                    </LinearGradientBrush>
                                </Border.OpacityMask>
                            </Border>
                            <Border x:Name="ItemContent" CornerRadius="5" MinHeight="30">
                                <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,3,5,3" OpacityMask="{x:Null}" SnapsToDevicePixels="True">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" MinWidth="250" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <CheckBox x:Name="cb1" Grid.RowSpan="2" Margin="3" Tag="{Binding}" Checked="CheckBoxChecked" Unchecked="CheckBoxUnChecked" VerticalAlignment="Center" HorizontalAlignment="Center" Height="21" Width="21">
                                        <CheckBox.IsChecked>
                                            <MultiBinding Converter="{StaticResource CollectionContainsTag2BoolConverter}">
                                                <Binding ElementName="cb1" Path="Tag"/>
                                                <Binding Path="DataContext.SelectedForPrinting" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window} }"/>
                                            </MultiBinding>
                                        </CheckBox.IsChecked>
                                    </CheckBox>
                                    <TextBlock x:Name="txtDetail1" Grid.Column="1" Grid.Row="0" Text="{Binding Path=DetailDescription}" FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif" />
                                    <TextBlock x:Name="txtDetail2" Grid.Column="1" Grid.Row="1" Text="{Binding Path=AddressString}" FontSize="12" Foreground="#FFA0A0A0" FontFamily="Microsoft Sans Serif" />
                                    <ListBox x:Name="listBoxDetail3" Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" ItemsSource="{Binding Path=CostBearerDetailStrings}" FontSize="12" Foreground="{Binding ForegroundBrush}" FontFamily="Microsoft Sans Serif" Background="Transparent" BorderThickness="0" IsHitTestVisible="False" Margin="6,0,0,0">
                                        <ListBox.ItemTemplate>
                                            <DataTemplate>
                                                <TextBlock Text="{Binding}" Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType={x:Type ListBox}, Mode=FindAncestor}}"/>
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>
                                    </ListBox>
                                </Grid>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <DataTrigger Binding="{Binding Path=IsArchived}" Value="True">
                                <Setter Property="Foreground" TargetName="txtDetail1" Value="#FF808080" />
                                <Setter Property="Foreground" TargetName="txtDetail2" Value="#FF808080" />
                                <Setter Property="Foreground" TargetName="listBoxDetail3" Value="#FF808080" />
                            </DataTrigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#33000000" Offset="0" />
                                            <GradientStop Color="#66000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="ListBoxItem.IsSelected" Value="True">
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#99000000" Offset="0" />
                                            <GradientStop Color="#CC000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="ListBoxItem.IsSelected" Value="True" />
                                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                                </MultiTrigger.Conditions>
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#99000000" Offset="0" />
                                            <GradientStop Color="#B2000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </MultiTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!-- EndRegion HilfeplanTemplate -->


        <!-- Region KlientenTemplate -->
        <Style x:Key="CustomerDetailStyle" TargetType="{x:Type ListBoxItem}">
            <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}" />
            <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}" />
            <Setter Property="Margin" Value="0,2,0,0" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Grid>
                            <Border x:Name="ItemBorder" CornerRadius="5" MinHeight="30" Background="#FF000000">
                                <Border.OpacityMask>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#19000000" Offset="0" />
                                        <GradientStop Color="#26000000" Offset="1" />
                                    </LinearGradientBrush>
                                </Border.OpacityMask>
                            </Border>
                            <Border x:Name="ItemContent" CornerRadius="5" MinHeight="30">
                                <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,3,5,3" OpacityMask="{x:Null}" SnapsToDevicePixels="True">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="Auto" SharedSizeGroup="CustomerDetailColumn" />
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <CheckBox x:Name="cb2" Grid.RowSpan="2" Margin="3" Tag="{Binding}" Checked="CheckBoxChecked" Unchecked="CheckBoxUnChecked" VerticalAlignment="Center" HorizontalAlignment="Center" Height="21" Width="21">
                                        <CheckBox.IsChecked>
                                            <MultiBinding Converter="{StaticResource CollectionContainsTag2BoolConverter}">
                                                <Binding ElementName="cb2" Path="Tag"/>
                                                <Binding Path="DataContext.SelectedForPrinting" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window} }"/>
                                            </MultiBinding>
                                        </CheckBox.IsChecked>
                                    </CheckBox>
                                    <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
                                        <TextBlock x:Name="txtDetail1" Text="{Binding Path=SimpleDescription}" FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif" />
                                        <TextBlock x:Name="txtDetail2" Text="{Binding Path=DateOfBirthString}" Margin="6,0,0,0" FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif" />
                                    </StackPanel>
                                    <StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal">
                                        <TextBlock x:Name="txtDetail3" Text="{Binding Path=AddressString}" FontSize="12" Foreground="#FFA0A0A0" FontFamily="Microsoft Sans Serif" />
                                    </StackPanel>
                                    <TextBlock Grid.Row="0" Grid.Column="2" x:Name="txtDetail4" Text="{Binding Path=CurrentEmployeeRole}" Margin="16,0,0,0" FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif" />
                                    <TextBlock Grid.Column="2" Grid.Row="1" x:Name="txtDetail5" Text="{Binding Path=MainAttendant}" Margin="16,0,0,0" FontSize="14" Foreground="#FFA0A0A0" FontFamily="Microsoft Sans Serif" />
                                </Grid>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <DataTrigger Binding="{Binding Path=IsArchived}" Value="True">
                                <Setter Property="Foreground" TargetName="txtDetail1" Value="#FF808080" />
                                <Setter Property="Foreground" TargetName="txtDetail2" Value="#FF808080" />
                                <Setter Property="Foreground" TargetName="txtDetail3" Value="#FF808080" />
                                <Setter Property="Foreground" TargetName="txtDetail4" Value="#FF808080" />
                                <Setter Property="Foreground" TargetName="txtDetail5" Value="#FF808080" />
                            </DataTrigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#33000000" Offset="0" />
                                            <GradientStop Color="#66000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="ListBoxItem.IsSelected" Value="True">
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#99000000" Offset="0" />
                                            <GradientStop Color="#CC000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="ListBoxItem.IsSelected" Value="True" />
                                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                                </MultiTrigger.Conditions>
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#99000000" Offset="0" />
                                            <GradientStop Color="#B2000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </MultiTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!-- EndRegion KlientenTemplate -->


        <!-- Region PersonenTemplate -->
        <Style x:Key="PersonDetailStyle" TargetType="{x:Type ListBoxItem}">
            <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}" />
            <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}" />
            <Setter Property="Margin" Value="0,2,0,0" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Grid>
                            <Border x:Name="ItemBorder" CornerRadius="5" MinHeight="30" Background="#FF000000">
                                <Border.OpacityMask>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#19000000" Offset="0" />
                                        <GradientStop Color="#26000000" Offset="1" />
                                    </LinearGradientBrush>
                                </Border.OpacityMask>
                            </Border>
                            <Border x:Name="ItemContent" CornerRadius="5" MinHeight="30">
                                <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,3,5,3" OpacityMask="{x:Null}" SnapsToDevicePixels="True" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" SharedSizeGroup="personDetailColumn1"/>
                                        <ColumnDefinition Width="Auto" SharedSizeGroup="personDetailColumn2"/>
                                        <ColumnDefinition Width="Auto" SharedSizeGroup="personDetailColumn3"/>
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <CheckBox x:Name="cb3" Grid.RowSpan="2" Margin="3" Tag="{Binding}" Checked="CheckBoxChecked" Unchecked="CheckBoxUnChecked" VerticalAlignment="Center" HorizontalAlignment="Center" Height="21" Width="21">
                                        <CheckBox.IsChecked>
                                            <MultiBinding Converter="{StaticResource CollectionContainsTag2BoolConverter}">
                                                <Binding ElementName="cb3" Path="Tag"/>
                                                <Binding Path="DataContext.SelectedForPrinting" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window} }"/>
                                            </MultiBinding>
                                        </CheckBox.IsChecked>
                                    </CheckBox>
                                    <TextBlock x:Name="txtDetail1" Grid.Row="0" Grid.Column="1" Text="{Binding Path=DetailDescription}" FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif" />
                                    <TextBlock x:Name="txtDetail2" Grid.Column="1" Grid.Row="1" Text="{Binding Path=AddressString}" FontSize="12" Foreground="#FFA0A0A0" FontFamily="Microsoft Sans Serif" />
                                    <TextBlock x:Name="txtDetail3" Grid.Row="0" Grid.Column="2" Text="{Binding Path=Function}" FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif" Margin="10,0,10,0"/>
                                    <TextBlock Visibility="Collapsed" x:Name="txtDetail4" Grid.Column="3" Grid.Row="0" Grid.RowSpan="2" Text="{Binding Path=ContactSummaryInfo}" FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif" />
                                    <StackPanel Orientation="Vertical" Grid.Column="3" Grid.Row="0" Grid.RowSpan="2">
                                        <TextBlock FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif">
                                            <TextBlock.Visibility>
                                                <Binding Path="Communication1">
                                                    <Binding.Converter>
                                                        <conv:ObjectVisibilityConverter/>
                                                    </Binding.Converter>
                                                </Binding>
                                            </TextBlock.Visibility>
                                            <TextBlock.Text>
                                                <MultiBinding StringFormat="{}Tel.: {0}">
                                                    <Binding  Path="Communication1"/>
                                                </MultiBinding>
                                            </TextBlock.Text>
                                        </TextBlock>
                                        <TextBlock FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif">
                                            <TextBlock.Visibility>
                                                <Binding Path="Communication2">
                                                    <Binding.Converter>
                                                        <conv:ObjectVisibilityConverter/>
                                                    </Binding.Converter>
                                                </Binding>
                                            </TextBlock.Visibility>
                                            <TextBlock.Text>
                                                <MultiBinding StringFormat="{}Mobil: {0}">
                                                    <Binding  Path="Communication2"/>
                                                </MultiBinding>
                                            </TextBlock.Text>
                                        </TextBlock>
                                        <TextBlock Text="EMail: " FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif">
                                            <TextBlock.Visibility>
                                                <Binding Path="Communication3">
                                                    <Binding.Converter>
                                                        <conv:ObjectVisibilityConverter/>
                                                    </Binding.Converter>
                                                </Binding>
                                            </TextBlock.Visibility>
                                        <TextBlock FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif">
                                                <TextBlock.Text>
                                                    <Binding Path="Communication3"/>
                                                </TextBlock.Text>
                                        </TextBlock>
                                    </TextBlock>
                                        <TextBlock FontSize="14" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif">
                                            <TextBlock.Visibility>
                                                <Binding Path="Communication4">
                                                    <Binding.Converter>
                                                        <conv:ObjectVisibilityConverter/>
                                                    </Binding.Converter>
                                                </Binding>
                                            </TextBlock.Visibility>
                                            <TextBlock.Text>
                                                <MultiBinding StringFormat="{}Fax: {0}">
                                                    <Binding  Path="Communication4"/>
                                                </MultiBinding>
                                            </TextBlock.Text>
                                        </TextBlock>
                                    </StackPanel>
                                </Grid>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <DataTrigger Binding="{Binding Path=IsArchived}" Value="True">
                                <Setter Property="Foreground" TargetName="txtDetail1" Value="#FF808080" />
                                <Setter Property="Foreground" TargetName="txtDetail2" Value="#FF808080" />
                                <Setter Property="Foreground" TargetName="txtDetail3" Value="#FF808080" />
                                <Setter Property="Foreground" TargetName="txtDetail4" Value="#FF808080" />
                            </DataTrigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#33000000" Offset="0" />
                                            <GradientStop Color="#66000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>

                            <Trigger Property="ListBoxItem.IsSelected" Value="True">
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#99000000" Offset="0" />
                                            <GradientStop Color="#CC000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="ListBoxItem.IsSelected" Value="True" />
                                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                                </MultiTrigger.Conditions>
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#99000000" Offset="0" />
                                            <GradientStop Color="#B2000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </MultiTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!-- EndRegion PersonenTemplate -->


        <!-- Region OrganisationenTemplate -->
        <Style x:Key="OrganisationDetailStyle" TargetType="{x:Type ListBoxItem}">
            <Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}" />
            <Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorLevel=1, AncestorType={x:Type ItemsControl}, Mode=FindAncestor}}" />
            <Setter Property="Margin" Value="0,2,0,0" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Grid>
                            <Border x:Name="ItemBorder" CornerRadius="5" MinHeight="30" Background="#FF000000">
                                <Border.OpacityMask>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#19000000" Offset="0" />
                                        <GradientStop Color="#26000000" Offset="1" />
                                    </LinearGradientBrush>
                                </Border.OpacityMask>
                            </Border>
                            <Border x:Name="ItemContent" CornerRadius="5" MinHeight="30">
                                <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="5,3,5,3" OpacityMask="{x:Null}" SnapsToDevicePixels="True">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <CheckBox x:Name="cb4" Checked="CheckBoxChecked" Unchecked="CheckBoxUnChecked" Grid.RowSpan="2" Margin="3" Tag="{Binding}" VerticalAlignment="Center" HorizontalAlignment="Center" Height="21" Width="21">
                                        <CheckBox.IsChecked>
                                            <MultiBinding Converter="{StaticResource CollectionContainsTag2BoolConverter}">
                                                <Binding ElementName="cb4" Path="Tag"/>
                                                <Binding Path="DataContext.SelectedForPrinting" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type Window} }"/>
                                            </MultiBinding>
                                        </CheckBox.IsChecked>
                                    </CheckBox>
                                    <TextBlock x:Name="txtDetail1" Grid.Row="0" Grid.Column="1" Text="{Binding Path=DetailDescription}" FontSize="14" Foreground="#FFFFFFFF" FontFamily="Microsoft Sans Serif" />
                                    <TextBlock x:Name="txtDetail2" Grid.Column="1" Grid.Row="1" Text="{Binding Path=AddressString}" FontSize="12" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif" />
                                </Grid>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <DataTrigger Binding="{Binding Path=IsArchived}" Value="True">
                                <Setter Property="Foreground" TargetName="txtDetail1" Value="#FF808080" />
                                <Setter Property="Foreground" TargetName="txtDetail2" Value="#FF808080" />
                            </DataTrigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#33000000" Offset="0" />
                                            <GradientStop Color="#66000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="ListBoxItem.IsSelected" Value="True">
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#99000000" Offset="0" />
                                            <GradientStop Color="#CC000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="ListBoxItem.IsSelected" Value="True" />
                                    <Condition Property="Selector.IsSelectionActive" Value="False" />
                                </MultiTrigger.Conditions>
                                <Setter Property="OpacityMask" TargetName="ItemBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#99000000" Offset="0" />
                                            <GradientStop Color="#B2000000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </MultiTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!-- EndRegion OrganisationenTemplate -->


        <detail:ListBoxItemStyleSelector x:Key="StyleSelector" 
                                         SupportConceptStyle="{StaticResource SupportConceptMailMergeDetailStyle}" 
                                         PersonStyle="{StaticResource PersonDetailStyle}" 
                                         CustomerStyle="{StaticResource CustomerDetailStyle}" 
                                         OrganisationStyle="{StaticResource OrganisationDetailStyle}" />
    </Window.Resources>
    <GroupBox Style="{DynamicResource MainContentGroupBoxWithoutMaximizeBtnStyle}" Header="Serienbrief drucken...">
        <Grid Margin="0,3,0,0" Background="{DynamicResource ObjectEditBackgroundBrush}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Label Grid.Row="0" Grid.Column="0" Margin="3" Content="Vorlage" />
                <ComboBox x:Name="VorlagenComboBox" Grid.Row="0" Grid.Column="1" Margin="3" DisplayMemberPath="FileName" ItemsSource="{Binding Path=WordTemplates, UpdateSourceTrigger=PropertyChanged}" SelectedIndex="0"/>
            </Grid>
            <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Margin="3" Grid.ColumnSpan="2">
                <Label Content="Suche" FontSize="14" Margin="0,-5,0,0" />
                <TextBox Foreground="Black" Height="20" x:Name="TextboxSearch" MinWidth="90" Margin="3,-5,0,0" Width="300" TabIndex="0" Template="{DynamicResource SearchTextBoxTemplate}" BorderThickness="0,0,0,0" />
                <TextBlock Margin="3,0,0,0" Foreground="Black" Text="{Binding Path=Items.Count, Converter={StaticResource StringFormatConverter}, ConverterParameter=Suchergebnisse: \{0\}, ElementName=ObjectListBox}" FontFamily="Microsoft Sans Serif" FontSize="14" />
            </StackPanel>
            <StackPanel Orientation="Horizontal" x:Name="SortPanel" Margin="3" Grid.Row="2" Grid.Column="0">
                <TextBlock Foreground="Black" HorizontalAlignment="Left" Text="Sortiert nach" FontFamily="Microsoft Sans Serif" FontSize="12" Margin="6,2,0,0" />
                <ComboBox x:Name="SortCombo" HorizontalAlignment="Left" FontFamily="Microsoft Sans Serif" FontSize="12" Margin="10,0,0,0" MinWidth="100" DisplayMemberPath="DisplayName" SelectionChanged="SortCombo_SelectionChanged" Style="{DynamicResource SortComboBox}" />
                <ToggleButton Style="{DynamicResource SortDirectionToggleButtonStyle}" x:Name="SortDirectionToggleButton" Click="SortDirectionToggleButton_Click" />
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right">
                <CheckBox x:Name="ChkShowArchived" Margin="3" VerticalAlignment="Center" Unchecked="ChkShowArchived_OnUnchecked" />
                <CheckBox x:Name="ChkShowOnlyMyObjects" Click="ChkShowOnlyMyObjects_OnClick" Margin="3" VerticalAlignment="Center" Unchecked="ChkShowArchived_OnUnchecked" />
            </StackPanel>
            <ListBox x:Name="ObjectListBox" Grid.Row="3" Grid.Column="0" Margin="3" Grid.ColumnSpan="2" ItemContainerStyleSelector="{StaticResource StyleSelector}">
                <ListBox.ItemsSource>
                    <MultiBinding Converter="{StaticResource FilterDCConverter}">
                        <Binding />
                        <Binding ElementName="TextboxSearch" Path="Text" />
                        <Binding ElementName="ChkShowArchived" Path="IsChecked" />
                        <Binding Path="CustomFilter">
                            <Binding.RelativeSource>
                                <RelativeSource Mode="FindAncestor" AncestorType="{x:Type detail:MailMergeWindow}" />
                            </Binding.RelativeSource>
                        </Binding>
                    </MultiBinding>
                </ListBox.ItemsSource>
            </ListBox>
            <CheckBox x:Name="AlleWaehlenCheckBox" Content="Alle auswählen" Grid.Row="4" Grid.Column="0" Margin="3" Checked="AlleWaehlenCheckBox_OnChecked" Unchecked="AlleWehlenCheckBox_OnUnchecked" />
            <StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center">
                <Button Margin="3" Click="PreviewBtnClick" Content="Vorschau" IsEnabled="{Binding SelectedForPrinting.Count, Converter={StaticResource CollectionCountToBoolConverter}}" />
                <Button Margin="3" Content="Drucken" Click="PrintBtnClick" IsEnabled="{Binding SelectedForPrinting.Count, Converter={StaticResource CollectionCountToBoolConverter}}" />
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center">
                <Button Margin="3" Content="Abbrechen" Command="Close" />
            </StackPanel>
        </Grid>
    </GroupBox>
</Window>
