如何禁用UI对象(UWP)的“动能”

时间:2016-08-13 11:26:59

标签: c# visual-studio xaml uwp

我在View上有Image我可以拖动。但是当我释放物体时它会移动一段时间。我怎么能禁用它?

我的Xaml代码:

 <Image Grid.Column="0"
           x:Name="CollageImg1"
           Margin="370,469,1665,800"
           Source="{Binding CollageImg1}"
           RenderTransformOrigin="0.5,0.5"
           ManipulationDelta="CollageImgage1_Manipulation"
           Visibility="Visible">
            <Image.RenderTransform>
                <CompositeTransform />
            </Image.RenderTransform>
        </Image>

用于移动的方法:

 private void Manipulation(ManipulationDeltaRoutedEventArgs e, Image image)
    { 
        CompositeTransform ct = (CompositeTransform)image.RenderTransform;
        ct.TranslateX += e.Delta.Translation.X;// X move
        ct.TranslateY += e.Delta.Translation.Y;// Ymove
    }

1 个答案:

答案 0 :(得分:1)

从图片的ManipulationMode属性中删除TranslateInertia

E.g。仅设置TranslateXTranslateY

<Image ManipulationMode="TranslateX,TranslateY" ... />