I'm using the Surface SDK for the multitouch support. I needed to move 2 sliders at the same time...
I've created some SurfaceSlider, works well, except that the control do some inertia after the movement...
Is there a way to disable inertia? I've searched over the web and I didn't find anything... they don't offer an option or anything like that...
If you need more informations to solve my problem just tell me...
Thanks
UPDATE: I've tried to make my own slider like this, but it doesn't work...
public class WtoSurfaceSlider : SurfaceSlider
{
#region " Ctors "
static WtoSurfaceSlider()
{
// Override metadata with style defined in themes xaml
DefaultStyleKeyProperty.OverrideMetadata(typeof(WtoSurfaceSlider), new FrameworkPropertyMetadata(typeof(WtoSurfaceSlider)));
}
public WtoSurfaceSlider()
{
Name = "New" + GetType().Name;
}
#endregion
#region " Method "
protected override void OnManipulationDelta(ManipulationDeltaEventArgs e)
{
if (e.IsInertial)
{
e.Complete();
e.Handled = true;
}
}
#endregion
}
EDIT
Finally, I found my answer with the comment of Eli Arbel. I declare my SurfaceSlider in a resource xaml file, so I don't have a .cs. So this works fine for me:
public class WtoSurfaceThumb : SurfaceThumb
{
#region " Ctors "
static WtoSurfaceThumb()
{
// Override metadata with style defined in themes xaml
DefaultStyleKeyProperty.OverrideMetadata(typeof(WtoSurfaceThumb), new FrameworkPropertyMetadata(typeof(WtoSurfaceThumb)));
}
public WtoSurfaceThumb()
{
Name = "New" + GetType().Name;
PreviewFlicked += new FlickEventHandler(WtoSurfaceThumb_PreviewFlicked);
}
#endregion
#region " Method "
private void WtoSurfaceThumb_PreviewFlicked(object sender, FlickEventArgs e)
{
e.Handled = true;
}
#endregion
}
And i replaced all the SurfaceThumb in my app by WtoSurfaceThumb.
You can use the following event:
<s:SurfaceSlider s:SurfaceThumb.PreviewFlicked="OnPreviewFlicked" />
And mark it as handled:
private void OnPreviewFlicked(object sender, FlickEventArgs e)
{
e.Handled = true;
}
As a side note - you can use a normal slider if you don't need the flick functionality. Multi-touch is built into WPF 4.