Windows Store 8 アプリに関する簡単な質問があります。
画面にテーブルのある写真があるとしましょう。ユーザーが「編集」ボタンを押すと、「完了」を押すまで、画面上の画像を目的の位置に移動できるはずです。
それを実装するには、どのクラスを使用する必要がありますか? また、C# での簡単なコード例もいいでしょう。
Windows Store 8 アプリに関する簡単な質問があります。
画面にテーブルのある写真があるとしましょう。ユーザーが「編集」ボタンを押すと、「完了」を押すまで、画面上の画像を目的の位置に移動できるはずです。
それを実装するには、どのクラスを使用する必要がありますか? また、C# での簡単なコード例もいいでしょう。
ManipulationDelta イベントを処理する必要があります。使用方法の例については、このページを参照してください。
例... XAML
<Rectangle Name="TestRectangle" Width="200" Height="200" Fill="Blue" ManipulationMode="All"/>
C#
private TranslateTransform dragTranslation;
// Constructor
public MainPage()
{
InitializeComponent();
// Add handler for the ManipulationDelta event
TestRectangle.ManipulationDelta += Drag_ManipulationDelta;
dragTranslation = new TranslateTransform();
TestRectangle.RenderTransform = this.dragTranslation;
}
void Drag_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
// Move the rectangle.
dragTranslation.X += e.Delta.Translation.X;
dragTranslation.Y += e.Delta.Translation.Y;
}