<UserControl x:Class="Showcase.WPF.DragDrop.Views.ListBoxSamples"
             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:dd="urn:gong-wpf-dragdrop"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:viewModels="clr-namespace:Showcase.WPF.DragDrop.ViewModels"
             d:DataContext="{d:DesignInstance viewModels:MainViewModel}"
             d:DesignHeight="400"
             d:DesignWidth="600"
             mc:Ignorable="d">

    <Grid>
        <Grid.Resources>
            <Style BasedOn="{StaticResource DefaultListBoxStyle}" TargetType="{x:Type ListBox}" />
        </Grid.Resources>

        <TabControl Style="{StaticResource ShowcaseTabControlStyle}">
            <TabItem Header="Bound">
                <DockPanel LastChildFill="True">
                    <TextBlock DockPanel.Dock="Top"
                               Style="{StaticResource SampleHeaderTextBlockStyle}"
                               Text="ListBox Bound" />
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <StackPanel>
                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Demonstrates the default behaviour with two ListBoxes bound to two collections of the same type. Just try drag and drop some Items from left ListBox to right ListBox." />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <ListBox x:Name="LeftBoundListBox"
                                         Grid.Column="0"
                                         dd:DragDrop.CanDragWithMouseRightButton="True"
                                         dd:DragDrop.DropTargetAdornerBrush="Coral"
                                         dd:DragDrop.IsDragSource="True"
                                         dd:DragDrop.IsDropTarget="True"
                                         dd:DragDrop.UseDefaultEffectDataTemplate="True"
                                         ItemsSource="{Binding Data.Collection1}" />
                                <ListBox Grid.Column="1"
                                         dd:DragDrop.DropTargetAdornerBrush="Coral"
                                         dd:DragDrop.IsDragSource="True"
                                         dd:DragDrop.IsDropTarget="True"
                                         dd:DragDrop.ShowAlwaysDropTargetAdorner="True"
                                         ItemsSource="{Binding Data.Collection2}" />
                            </Grid>

                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Customization (for left ListBox)" />
                            <CheckBox Margin="10 5"
                                      Content="IsDragSource"
                                      IsChecked="{Binding ElementName=LeftBoundListBox, Path=(dd:DragDrop.IsDragSource), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="CanDragWithMouseRightButton"
                                      IsChecked="{Binding ElementName=LeftBoundListBox, Path=(dd:DragDrop.CanDragWithMouseRightButton), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="IsDropTarget"
                                      IsChecked="{Binding ElementName=LeftBoundListBox, Path=(dd:DragDrop.IsDropTarget), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="UseDefaultDragAdorner"
                                      IsChecked="{Binding ElementName=LeftBoundListBox, Path=(dd:DragDrop.UseDefaultDragAdorner), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="UseDefaultEffectDataTemplate"
                                      IsChecked="{Binding ElementName=LeftBoundListBox, Path=(dd:DragDrop.UseDefaultEffectDataTemplate), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        </StackPanel>
                    </ScrollViewer>
                </DockPanel>
            </TabItem>

            <TabItem Header="Unbound">
                <DockPanel LastChildFill="True">
                    <TextBlock DockPanel.Dock="Top"
                               Style="{StaticResource SampleHeaderTextBlockStyle}"
                               Text="ListBox Unbound" />
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <StackPanel>
                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Demonstrates the default behaviour with two ListBoxes and unbound items (e.g. direct usage of ListBoxItem). Just try drag and drop some Items from left ListBox to right ListBox." />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <ListBox x:Name="LeftUnboundListBox"
                                         Grid.Column="0"
                                         dd:DragDrop.IsDragSource="True"
                                         dd:DragDrop.IsDropTarget="True"
                                         dd:DragDrop.UseDefaultEffectDataTemplate="True">
                                    <ListBoxItem>Unbound Item1</ListBoxItem>
                                    <ListBoxItem>Unbound Item2</ListBoxItem>
                                    <ListBoxItem>Unbound Item3</ListBoxItem>
                                    <ListBoxItem>Unbound Item4</ListBoxItem>
                                    <ListBoxItem>Unbound Item5</ListBoxItem>
                                </ListBox>
                                <ListBox Grid.Column="1"
                                         dd:DragDrop.IsDragSource="True"
                                         dd:DragDrop.IsDropTarget="True">
                                    <ListBoxItem>Unbound Item6</ListBoxItem>
                                    <ListBoxItem>Unbound Item7</ListBoxItem>
                                    <ListBoxItem>Unbound Item8</ListBoxItem>
                                    <ListBoxItem>Unbound Item9</ListBoxItem>
                                    <ListBoxItem>Unbound Item10</ListBoxItem>
                                </ListBox>
                            </Grid>

                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Customization (for left ListBox)" />
                            <CheckBox Margin="10 5"
                                      Content="IsDragSource"
                                      IsChecked="{Binding ElementName=LeftUnboundListBox, Path=(dd:DragDrop.IsDragSource), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="IsDropTarget"
                                      IsChecked="{Binding ElementName=LeftUnboundListBox, Path=(dd:DragDrop.IsDropTarget), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="UseDefaultDragAdorner"
                                      IsChecked="{Binding ElementName=LeftUnboundListBox, Path=(dd:DragDrop.UseDefaultDragAdorner), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="UseDefaultEffectDataTemplate"
                                      IsChecked="{Binding ElementName=LeftUnboundListBox, Path=(dd:DragDrop.UseDefaultEffectDataTemplate), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        </StackPanel>
                    </ScrollViewer>
                </DockPanel>
            </TabItem>

            <TabItem Header="Horizontal">
                <DockPanel LastChildFill="True">
                    <TextBlock DockPanel.Dock="Top"
                               Style="{StaticResource SampleHeaderTextBlockStyle}"
                               Text="ListBox Horizontal" />
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <StackPanel>
                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Demonstrates the default behaviour with horizontal ListBoxes and right to left flow direction." />
                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Unbound ListBox" />
                            <ListBox Height="Auto"
                                     dd:DragDrop.DefaultDragAdornerOpacity="0.5"
                                     dd:DragDrop.IsDragSource="True"
                                     dd:DragDrop.IsDropTarget="True"
                                     dd:DragDrop.UseDefaultDragAdorner="True"
                                     SelectionMode="Extended">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Margin="1" Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBoxItem>ListBoxItem1</ListBoxItem>
                                <ListBoxItem>ListBoxItem2</ListBoxItem>
                                <ListBoxItem>ListBoxItem3</ListBoxItem>
                                <ListBoxItem>ListBoxItem4</ListBoxItem>
                                <ListBoxItem>ListBoxItem5</ListBoxItem>
                            </ListBox>

                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="ListBox bound to a collection" />
                            <ListBox Height="Auto"
                                     dd:DragDrop.DefaultDragAdornerOpacity="0.5"
                                     dd:DragDrop.IsDragSource="True"
                                     dd:DragDrop.IsDropTarget="True"
                                     dd:DragDrop.UseDefaultDragAdorner="True"
                                     ItemsSource="{Binding Data.Collection1}"
                                     SelectionMode="Extended">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Margin="1" Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                            </ListBox>

                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="ListBox with right to left flow direction for the ItemsPanel" />
                            <ListBox Height="Auto"
                                     dd:DragDrop.IsDragSource="True"
                                     dd:DragDrop.IsDropTarget="True"
                                     dd:DragDrop.UseDefaultDragAdorner="True"
                                     SelectionMode="Extended">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Margin="1"
                                                    FlowDirection="RightToLeft"
                                                    Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <ListBoxItem>ListBoxItem6</ListBoxItem>
                                <ListBoxItem>ListBoxItem7</ListBoxItem>
                                <ListBoxItem>ListBoxItem8</ListBoxItem>
                                <ListBoxItem>ListBoxItem9</ListBoxItem>
                                <ListBoxItem>ListBoxItem10</ListBoxItem>
                            </ListBox>

                            <TextBlock Margin="4 8 4 4"
                                       Style="{StaticResource DefaultTextBlockStyle}"
                                       Text="FlowDirection=&quot;RightToLeft&quot; for the ItemsPanel doesn't work in this case! The insertion adorner will be wrong calculated." />
                            <ListBox Height="Auto"
                                     dd:DragDrop.IsDragSource="True"
                                     dd:DragDrop.IsDropTarget="True"
                                     dd:DragDrop.UseDefaultDragAdorner="True"
                                     ItemContainerStyle="{x:Null}"
                                     SelectionMode="Extended">
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Margin="1"
                                                    FlowDirection="RightToLeft"
                                                    Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <Rectangle Width="100"
                                           Height="60"
                                           Fill="LightCoral"
                                           Stroke="Black" />
                                <Rectangle Width="120"
                                           Height="60"
                                           Fill="LightCyan"
                                           Stroke="Black" />
                                <Rectangle Width="140"
                                           Height="60"
                                           Fill="LightGreen"
                                           Stroke="Black" />
                                <Rectangle Width="160"
                                           Height="60"
                                           Fill="LightPink"
                                           Stroke="Black" />
                            </ListBox>

                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Set RotateTransform of ListBox to ScaleTransform ScaleX=&quot;-1&quot;." />
                            <ListBox Height="Auto"
                                     dd:DragDrop.IsDragSource="True"
                                     dd:DragDrop.IsDropTarget="True"
                                     dd:DragDrop.UseDefaultDragAdorner="True"
                                     ItemContainerStyle="{x:Null}"
                                     RenderTransformOrigin="0.5,0.5"
                                     SelectionMode="Extended">
                                <ListBox.RenderTransform>
                                    <ScaleTransform ScaleX="-1" />
                                </ListBox.RenderTransform>
                                <ListBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <StackPanel Margin="1" Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </ListBox.ItemsPanel>
                                <Rectangle Width="100"
                                           Height="60"
                                           Fill="LightCoral"
                                           Stroke="Black" />
                                <Rectangle Width="120"
                                           Height="60"
                                           Fill="LightCyan"
                                           Stroke="Black" />
                                <Rectangle Width="140"
                                           Height="60"
                                           Fill="LightGreen"
                                           Stroke="Black" />
                                <Rectangle Width="160"
                                           Height="60"
                                           Fill="LightPink"
                                           Stroke="Black" />
                            </ListBox>
                        </StackPanel>
                    </ScrollViewer>
                </DockPanel>
            </TabItem>

            <TabItem Header="Grouping">
                <TabItem.Resources>
                    <CollectionViewSource x:Key="GroupedCollectionViewSource" Source="{Binding Data.GroupedCollection}">
                        <CollectionViewSource.GroupDescriptions>
                            <PropertyGroupDescription PropertyName="Group" />
                        </CollectionViewSource.GroupDescriptions>
                    </CollectionViewSource>
                </TabItem.Resources>
                <DockPanel LastChildFill="True">
                    <TextBlock DockPanel.Dock="Top"
                               Style="{StaticResource SampleHeaderTextBlockStyle}"
                               Text="ListBox Grouping" />
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <StackPanel>
                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Demonstrates the behaviour with a ListBox which is bound to a grouped collection (CollectionViewSource). The ListBox uses also a custom DropHandler to handle the drop action." />
                            <ListBox x:Name="GroupedListBox"
                                     dd:DragDrop.DragDirectlySelectedOnly="True"
                                     dd:DragDrop.DropHandler="{Binding Data.GroupedDropHandler}"
                                     dd:DragDrop.IsDragSource="True"
                                     dd:DragDrop.IsDropTarget="True"
                                     DisplayMemberPath="Caption"
                                     ItemsSource="{Binding Source={StaticResource GroupedCollectionViewSource}}"
                                     SelectionMode="Extended">
                                <ListBox.GroupStyle>
                                    <x:Static Member="GroupStyle.Default" />
                                </ListBox.GroupStyle>
                            </ListBox>

                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Customization" />
                            <CheckBox Margin="10 5"
                                      Content="IsDragSource"
                                      IsChecked="{Binding ElementName=GroupedListBox, Path=(dd:DragDrop.IsDragSource), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="IsDropTarget"
                                      IsChecked="{Binding ElementName=GroupedListBox, Path=(dd:DragDrop.IsDropTarget), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="UseDefaultDragAdorner"
                                      IsChecked="{Binding ElementName=GroupedListBox, Path=(dd:DragDrop.UseDefaultDragAdorner), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="UseDefaultEffectDataTemplate"
                                      IsChecked="{Binding ElementName=GroupedListBox, Path=(dd:DragDrop.UseDefaultEffectDataTemplate), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        </StackPanel>
                    </ScrollViewer>
                </DockPanel>
            </TabItem>

            <TabItem Header="DragDropKeyStates">
                <TabItem.Resources>
                    <ObjectDataProvider x:Key="DragDropKeyStatesEnumValues"
                                        MethodName="GetValues"
                                        ObjectType="{x:Type DragDropKeyStates}">
                        <ObjectDataProvider.MethodParameters>
                            <x:Type TypeName="DragDropKeyStates" />
                        </ObjectDataProvider.MethodParameters>
                    </ObjectDataProvider>
                </TabItem.Resources>
                <DockPanel LastChildFill="True">
                    <TextBlock DockPanel.Dock="Top"
                               Style="{StaticResource SampleHeaderTextBlockStyle}"
                               Text="ListBox DragDropKeyStates" />
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <StackPanel>
                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Demonstrates the DragDropCopyKeyState behaviour with two ListBoxes bound to two collections of the same type. Try changing the DragDropCopyKeyState for the left ListBox and see what happens." />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <ListBox x:Name="LeftListBoxOfDragDropKeyStatesSample"
                                         Grid.Column="0"
                                         dd:DragDrop.DragDropCopyKeyState="ControlKey"
                                         dd:DragDrop.IsDragSource="True"
                                         dd:DragDrop.IsDropTarget="True"
                                         dd:DragDrop.UseDefaultEffectDataTemplate="True"
                                         ItemsSource="{Binding Data.Collection1}" />
                                <ListBox Grid.Column="1"
                                         dd:DragDrop.IsDragSource="True"
                                         dd:DragDrop.IsDropTarget="True"
                                         ItemsSource="{Binding Data.Collection2}" />
                            </Grid>

                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="Customization (for left ListBox)" />
                            <StackPanel Margin="10 5" Orientation="Horizontal">
                                <TextBlock VerticalAlignment="Center" Text="DragDropCopyKeyState" />
                                <ComboBox Width="200"
                                          Margin="5 0 0 0"
                                          VerticalAlignment="Center"
                                          ItemsSource="{Binding Source={StaticResource DragDropKeyStatesEnumValues}}"
                                          SelectedItem="{Binding ElementName=LeftListBoxOfDragDropKeyStatesSample, Path=(dd:DragDrop.DragDropCopyKeyState), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            </StackPanel>
                            <CheckBox Margin="10 5"
                                      Content="IsDragSource"
                                      IsChecked="{Binding ElementName=LeftListBoxOfDragDropKeyStatesSample, Path=(dd:DragDrop.IsDragSource), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="IsDropTarget"
                                      IsChecked="{Binding ElementName=LeftListBoxOfDragDropKeyStatesSample, Path=(dd:DragDrop.IsDropTarget), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="UseDefaultDragAdorner"
                                      IsChecked="{Binding ElementName=LeftListBoxOfDragDropKeyStatesSample, Path=(dd:DragDrop.UseDefaultDragAdorner), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            <CheckBox Margin="10 5"
                                      Content="UseDefaultEffectDataTemplate"
                                      IsChecked="{Binding ElementName=LeftListBoxOfDragDropKeyStatesSample, Path=(dd:DragDrop.UseDefaultEffectDataTemplate), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        </StackPanel>
                    </ScrollViewer>
                </DockPanel>
            </TabItem>

            <TabItem Header="List in List">
                <DockPanel LastChildFill="True">
                    <TextBlock DockPanel.Dock="Top"
                               Style="{StaticResource SampleHeaderTextBlockStyle}"
                               Text="ListBox List in List" />
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <StackPanel>
                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="This sample comes from an issue and demonstrates the behaviour of nested ListBoxes." />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <ListBox Grid.Column="0"
                                         Height="450"
                                         dd:DragDrop.IsDragSource="True"
                                         dd:DragDrop.UseDefaultDragAdorner="True"
                                         ItemsSource="{Binding Data.Collection1}" />
                                <ListBox x:Name="Outer"
                                         Grid.Column="1"
                                         Height="450"
                                         dd:DragDrop.IsDropTarget="True">
                                    <Border BorderBrush="Silver" BorderThickness="1">
                                        <ListBox x:Name="Inner1"
                                                 Width="200"
                                                 Height="150"
                                                 HorizontalContentAlignment="Stretch"
                                                 dd:DragDrop.IsDragSource="True"
                                                 dd:DragDrop.IsDropTarget="True"
                                                 dd:DragDrop.UseDefaultDragAdorner="True"
                                                 Background="DarkOrange"
                                                 ItemsSource="{Binding Data.Collection2}" />
                                    </Border>
                                    <Border BorderBrush="Silver" BorderThickness="1">
                                        <ListBox x:Name="Inner2"
                                                 Width="200"
                                                 Height="150"
                                                 HorizontalContentAlignment="Stretch"
                                                 dd:DragDrop.IsDragSource="True"
                                                 dd:DragDrop.IsDropTarget="True"
                                                 dd:DragDrop.UseDefaultDragAdorner="True"
                                                 Background="DarkSeaGreen">
                                            <ListBoxItem Content="ListBoxItem1" />
                                            <ListBoxItem Content="ListBoxItem2" />
                                        </ListBox>
                                    </Border>
                                </ListBox>
                            </Grid>
                        </StackPanel>
                    </ScrollViewer>
                </DockPanel>
            </TabItem>

            <TabItem Header="Undraggable List in List">
                <DockPanel LastChildFill="True">
                    <TextBlock DockPanel.Dock="Top"
                               Style="{StaticResource SampleHeaderTextBlockStyle}"
                               Text="ListBox Undraggable List in List" />
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <StackPanel>
                            <TextBlock Style="{StaticResource DefaultTextBlockStyle}" Text="This sample comes from an issue and demonstrates the behaviour of nested ListBoxes that can be dragged in the outer ListBox while their own items cannot be dragged" />
                            <ListBox x:Name="Outer2"
                                     Height="450"
                                     dd:DragDrop.IsDragSource="True"
                                     dd:DragDrop.IsDropTarget="True"
                                     dd:DragDrop.UseDefaultDragAdorner="True">
                                <Border BorderBrush="Silver" BorderThickness="1">
                                    <ListBox x:Name="Inner3"
                                             Width="200"
                                             Height="150"
                                             HorizontalContentAlignment="Stretch"
                                             Background="HotPink">
                                        <ListBoxItem Content="ListBoxItem1 Inner3" />
                                        <ListBoxItem Content="ListBoxItem2 Inner3" />
                                    </ListBox>
                                </Border>
                                <Border BorderBrush="Silver" BorderThickness="1">
                                    <ListBox x:Name="Inner4"
                                             Width="200"
                                             Height="150"
                                             HorizontalContentAlignment="Stretch"
                                             Background="LightSkyBlue">
                                        <ListBoxItem Content="ListBoxItem1 Inner4" />
                                        <ListBoxItem Content="ListBoxItem2 Inner4" />
                                        <ListBoxItem Content="ListBoxItem3 Inner4" />
                                    </ListBox>
                                </Border>
                            </ListBox>
                        </StackPanel>
                    </ScrollViewer>
                </DockPanel>
            </TabItem>

        </TabControl>

    </Grid>

</UserControl>