<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <DataTemplate x:Key="SourceToTarget">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="60"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <ListBox ItemsSource="{Binding SourceItems}"
                     SelectedItem="{Binding SelectedSourceItem}"
                     ItemTemplate="{Binding ItemDataTemplate}">
                <!--<InputBindingCollection>
                    <MouseBinding Gesture="LeftDoubleClick" Command="{Binding AddSelected}"/>
                </InputBindingCollection>-->
            </ListBox>
            <StackPanel Grid.Column="1">
                <Button Content="Add all" Command="{Binding AddAll}"/>
                <Button Content="Clear all" Command="{Binding ClearAll}"/>
                <Button Content=">>" Command="{Binding AddSelected}"/>
                <Button Content="&lt;&lt;" Command="{Binding RemoveSelected}"/>
            </StackPanel>
            <ListBox Grid.Column="2" ItemsSource="{Binding TargetItems}"
                     SelectedItem="{Binding SelectedTargetItem}"
                     ItemTemplate="{Binding ItemDataTemplate}"
                     >
                <!--<InputBindingCollection>
                    <MouseBinding Gesture="LeftDoubleClick" Command="{Binding RemoveSelected}"/>
                </InputBindingCollection>-->
            </ListBox>
        </Grid>
    </DataTemplate>
    <DataTemplate x:Key="SelectItems">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel Height="27" Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding ShowButtons, Converter={StaticResource BooleanToVisibilityConverter}}">
                <Button Margin="0,0,2,0" Command="{Binding SelectAllCommand}" ToolTip="Select all">
                    <Viewbox Width="24" Height="24">
                        <ContentControl ContentTemplate="{StaticResource SelectAll}"/>
                    </Viewbox>
                </Button>
                <Button Margin="0,0,2,0" Command="{Binding UnSelectAllCommand}" ToolTip="Unselect all">
                    <Viewbox Width="24" Height="24">
                        <ContentControl ContentTemplate="{StaticResource DeSelectAll}"/>
                    </Viewbox>
                </Button>
                <Button Margin="0,0,2,0" Command="{Binding InvertSelectionCommand}"  ToolTip="Invert selection">
                    <Viewbox Width="24" Height="24">
                        <ContentControl ContentTemplate="{StaticResource InvertSelection}"/>
                    </Viewbox>
                </Button>
            </StackPanel>
            <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Visible">
                <ListBox ItemsSource="{Binding CollectionItems}" SelectedItem="SelectedItem" HorizontalAlignment="Stretch">
                    <ListBox.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="Select All" Command="{Binding SelectAllCommand}"/>
                            <MenuItem Header="UnSelect All" Command="{Binding UnSelectAllCommand}"/>
                            <MenuItem Header="Unvert Selection" Command="{Binding InvertSelectionCommand}"/>
                        </ContextMenu>
                    </ListBox.ContextMenu>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="22"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <CheckBox IsChecked="{Binding IsSelected}"/>
                                <ContentControl Grid.Column="1" ContentTemplate="{StaticResource ColoredItemTemplate}" Content="{Binding Item}"/>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </ScrollViewer>
        </Grid>
    </DataTemplate>
</ResourceDictionary>