Hi Friends
Hope you all are doing good.
I have few questions about WPF List BOX
Some Background:
We are trying to build a scheduling control like outlook with some custom functionality.
I have already gone through the similar post in Code Project but we tend to take slightly different approach (trying to use MVVM approach).
Problem:
Currently we have a Listbox with 3 items. Each item in the list box is another Listbox with borders as sub items. For E.g. the XAML code looks like this.
<Grid Height="500" Width="500">
<ListBox Name="MasterListBox" HorizontalAlignment="Stretch">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBoxItem >
<ListBox Name="Child1" Height="240">
<ListBoxItem >
<Border Width="200" removed="Red" Height="40"></Border>
</ListBoxItem>
<ListBoxItem >
<Border Width="200" removed="Blue" Height="40"></Border>
</ListBoxItem>
<ListBoxItem >
<Border Width="200" removed="Green" Height="40"></Border>
</ListBoxItem>
</ListBox>
</ListBoxItem>
<ListBoxItem >
<ListBox Name="Child2" Height="240">
<ListBoxItem >
<Border Width="200" removed="Yellow" Height="40"></Border>
</ListBoxItem>
<ListBoxItem >
<Border Width="200" removed="Green" Height="40"></Border>
</ListBoxItem>
<ListBoxItem >
<Border Width="200" removed="Pink" Height="40"></Border>
</ListBoxItem>
</ListBox>
</ListBoxItem>
<ListBoxItem >
<ListBox Name="Child3" Height="240">
<ListBoxItem >
<Border Width="200" removed="Aqua" Height="40"></Border>
</ListBoxItem>
<ListBoxItem >
<Border Width="200" removed="Beige" Height="40"></Border>
</ListBoxItem>
<ListBoxItem >
<Border Width="200" removed="Brown" Height="40"></Border>
</ListBoxItem>
</ListBox>
</ListBoxItem>
</ListBox>
</Grid>
The problem is when I click on the 1st item(Child1) of the MasterListBox in the white area and drag right, the MasterListBox list box scroll to right, But when I click on the subitem (for e.g. say red border) and drag right the MasterListBox doesn’t scroll right.
I am aware that I am trying to drag the item of the inner list box and that’s the reason the outer list box is not scrolling, But it there a way we can override this. I want to select the inner item also so cannot set IsHitTestVisible="False" for inner item.
Thanks you for looking into this. Your help is greatly appreciated.
Regards
Saurabh