我在Image
...
Scrollviewer
<ScrollViewer x:Name="Scrollster" ZoomMode="Enabled" MinZoomFactor="1" MaxZoomFactor="4"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" ManipulationMode="All">
<Image x:Name="Img" Source="{x:Bind ImgSource}" Stretch="UniformToFill" PointerPressed="Img_PointerPressed"/>
</ScrollViewer>
我想用鼠标指针拖动图像时移动图像!
我试过了:
private void Img_PointerPressed(object sender,PointerRoutedEventArgs e)
{
var p = e.Pointer;
}
但我无法获得指针位置来更改scrollviewer位置。
我的代码出了什么问题?我做得对吗?
答案 0 :(得分:7)
应该在<?php
//code here to return just the text or whatever
// You should actually have the ajax call a page that has the "echoSkill()"
// function on it rather than the function page itself
echo 'Response to ajax page.';
echoSkill($blah,$blah2,$blah3,$blah4,$blah5,$blah6);
print_r($_POST);
?>
控件上设置ManipulationMode
。此外,您可能希望指定所需的确切模式,而不是Img
以防止不必要的手势处理。
All
从上面的描述中,我认为启用<Image x:Name="Img" Source="{x:Bind ImgSource}" Width="150" Height="150" Stretch="UniformToFill"
ManipulationMode="TranslateX, TranslateY"
ManipulationStarted="Img_ManipulationStarted"
ManipulationDelta="Img_ManipulationDelta"
ManipulationCompleted="Img_ManipulationCompleted">
<Image.RenderTransform>
<CompositeTransform x:Name="Transform" />
</Image.RenderTransform>
</Image>
和TranslateX
就足够了。然后,您需要处理诸如TranslateY
,ManipulationStarted
和ManipulationDelta
之类的操纵事件。
你的大多数逻辑都应该在ManipulationCompleted
事件中完成,这会在平移过程中多次触发。您可以在此处获得ManipulationDelta
和X
位置,并相应地进行设置。
以下是一个简单的示例。
Y