WPF 4.0:
I have scroll viewer with many Sliders inside of it. I want the scroll viewer to pan with touch, and I want the internal slider to also respond to touch.
Unfortunately, the scroll viewer is eating the "TouchMove" events and not passing them down to the slider control. Any idea how to fix this?
Here is my XAML:
<Window x:Class="ScrollingTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<ItemsControl ItemsSource="{Binding}">
<ItemsControl.Template>
<ControlTemplate>
<ScrollViewer VerticalScrollBarVisibility="Auto" PanningMode="Both" >
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Height="100" BorderThickness="2" BorderBrush="Black">
<Slider Value="{Binding ., Mode=TwoWay}" Width="300" Minimum="0" Maximum="100" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Window>
And my Code-behind:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DataContext = Items;
}
public IEnumerable<int> Items
{
get
{
return Enumerable.Range(0, 50);
}
}
}