<UserControl x:Class="BeWo.View.Search.MultiCustomerSearchView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:converter="clr-namespace:BeWo.Scheduler.Converter"
             mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
	<UserControl.Resources>
		<converter:CheckBoxConverter x:Key="CheckBoxConverter" />
	</UserControl.Resources>
    <Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="Auto" />
			<ColumnDefinition Width="*" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<Label Content="Suche:" Grid.Column="0" Grid.Row="0" Margin="3" Foreground="#FFD2D2D2" VerticalAlignment="Center" />
		<TextBox x:Name="SuchTextBox" Grid.Column="1" Grid.Row="0" Margin="0,3,3,3" TextChanged="SuchTextBox_OnPreviewKeyDown" />
		<ListBox Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" x:Name="listbox_result" ItemsSource="{Binding Path=AngezeigteKlienten, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" HorizontalContentAlignment="Stretch" BorderThickness="0" Margin="2">
			<ListBox.ItemTemplate>
				<DataTemplate>
					<Grid>
						<Border CornerRadius="5" MinHeight="23" Background="{StaticResource CustomerContentBrush}" Margin="0,1,3,1" />
						<Border x:Name="ItemBorder" CornerRadius="5" MinHeight="23" Background="#FF000000" Margin="0,1,3,1">
							<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 BorderBrush="{x:Null}" Height="23" CornerRadius="5">
							<CheckBox Margin="6,0,0,0" VerticalAlignment="Center" Foreground="#FFD2D2D2" FontFamily="Microsoft Sans Serif" Tag="{Binding}" Content="{Binding Path=DetailDescription}" Checked="CustomerCheckedEvent" Unchecked="CustomerCheckedEvent" PreviewMouseDown="CustomerLB_OnClick">
								<CheckBox.IsChecked>
									<MultiBinding Converter="{StaticResource CheckBoxConverter}" ConverterParameter="Klienten" UpdateSourceTrigger="PropertyChanged" NotifyOnSourceUpdated="True">
										<Binding Path="CustomerOid" Mode="OneWay" />
										<Binding Path="AusgewaehlteKlienten" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type UserControl}}" />
									</MultiBinding>
								</CheckBox.IsChecked>
							</CheckBox>
						</Border>
					</Grid>
					<DataTemplate.Triggers>
						<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>
					</DataTemplate.Triggers>
				</DataTemplate>
			</ListBox.ItemTemplate>
		</ListBox>

		<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*" />
				<ColumnDefinition Width="Auto" />
			</Grid.ColumnDefinitions>
			<CheckBox HorizontalAlignment="Left" VerticalAlignment="Center" Margin="12,3,3,3" Foreground="#FFD2D2D2" Grid.Column="0" Content="Alle auswählen" Checked="AlleSelektierenCBUnChecked" Unchecked="AlleSelektierenCBUnChecked" IsThreeState="False" />
			<Button HorizontalAlignment="Right" Grid.Column="1" Margin="3" Content="Schließen" Width="70" Height="25" Command="ApplicationCommands.Close" />
		</Grid>
		
	</Grid>
</UserControl>
