0
現在、Windows Phone 8用の古いゲームをWPF/SilverlightでUniversal Windows Platformに移植しています。 MouseDragElementBehaviorクラスを使用してキャンバス内を移動できる文字を作成しました。このクラスのUWPに類似点はありますか?MouseDragElementBehavior in UWP
現在、Windows Phone 8用の古いゲームをWPF/SilverlightでUniversal Windows Platformに移植しています。 MouseDragElementBehaviorクラスを使用してキャンバス内を移動できる文字を作成しました。このクラスのUWPに類似点はありますか?MouseDragElementBehavior in UWP
コメントには、ManipulationDeltaというイベントがあります。ここでは、あなたがそれを使用する方法である。そのような単純なよう
private void LetterA_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
dragLetterA.X += e.Delta.Translation.X;
dragLetterA.Y += e.Delta.Translation.Y;
}
private void LetterB_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
dragLetterB.X += e.Delta.Translation.X;
dragLetterB.Y += e.Delta.Translation.Y;
}
private void LetterC_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
dragLetterC.X += e.Delta.Translation.X;
dragLetterC.Y += e.Delta.Translation.Y;
}
:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Canvas>
<TextBlock
FontSize="64"
ManipulationDelta="LetterA_ManipulationDelta"
ManipulationMode="All"
RenderTransformOrigin="0.5,0.5"
Text="A">
<TextBlock.RenderTransform>
<TranslateTransform x:Name="dragLetterA" />
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock
FontSize="64"
ManipulationDelta="LetterB_ManipulationDelta"
ManipulationMode="All"
RenderTransformOrigin="0.5,0.5"
Text="B">
<TextBlock.RenderTransform>
<TranslateTransform x:Name="dragLetterB" />
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock
FontSize="64"
ManipulationDelta="LetterC_ManipulationDelta"
ManipulationMode="All"
RenderTransformOrigin="0.5,0.5"
Text="C">
<TextBlock.RenderTransform>
<TranslateTransform x:Name="dragLetterC" />
</TextBlock.RenderTransform>
</TextBlock>
</Canvas>
</Grid>
コードが背後にある次のようになります。
これが役に立ちます。
なぜManipulationDeltaイベントを試してみませんか? – Apoorv
私は、uwpプロジェクトのためにwpfのような振る舞いをするはずのナゲットパッケージを見たと思います –