I have added a ListView dynamically and it displays all the data correctly. Now as the amount of data increases I want to allow user to scroll horizontally and not vertically, so I added ScrollViewer property for ListView using the following code
myListView = new ListView();
myListView.ItemsPanel = App.Current.Resources["MyItemsPanel"] as ItemsPanelTemplate;
myListView.ItemTemplate = App.Current.Resources["myListTemplate"] as DataTemplate;
myListView.ItemContainerStyle = App.Current.Resources["GenericListViewContainerStyle"] as Style;
myListView.SelectionMode = ListViewSelectionMode.Multiple;
myListView.Margin = new Thickness(10);
myListView.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);
myListView.SetValue(ScrollViewer.VerticalScrollModeProperty, ScrollMode.Disabled);
myListView.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Hidden);
myListView.SetValue(ScrollViewer.HorizontalScrollModeProperty, ScrollMode.Auto);
ItemsPanel Template
<ItemsPanelTemplate x:Key="MyItemsPanel">
<StackPanel Orientation="Horizontal">
<StackPanel.RenderTransform>
<TranslateTransform X="0" />
</StackPanel.RenderTransform>
</StackPanel>
</ItemsPanelTemplate>
Can someone suggest what is wrong here? I want it to work both using Mouse and Touch input. My Current works fine with touch input but I can't scroll when I use mouse pointer.