none
Swapping listbox items one by one

    General discussion

  • Hi Folks,

    I have one databound listbox which displays items Horizontally, for that i am using <StackPanel Orientation="Horizontal" /> as ItemsPanelTemplate. Further my requirement is to swap items one by one ONLY.

    <ListBox Name="listContainer" ItemsSource="{Binding}"
                     VerticalAlignment="Center"
                     ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                     ScrollViewer.VerticalScrollBarVisibility="Disabled">
                <ListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"></StackPanel>
                    </ItemsPanelTemplate>
                </ListBox.ItemsPanel>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        ...
                    </DataTemplate>
                </ListBox.ItemTemplate>
    </ListBox>

    Meaning that, if i flick 1st item, list should stop on the 2nd item and should not scroll further. I tried many ways but could not find a way to stop scrollviewer's (one which lies in the VisualTree underneath Listbox) scrolling.

    Any thoughts?

    Tuesday, August 16, 2011 9:59 AM

All replies

  • i really dont know how to do this one but, i think we need to control the mouse wheel pagescroll property. i dont know if silverlight supports that and listbox too. But try messing with the mouse handlers and propertys.

    Wednesday, August 17, 2011 1:48 PM