0
ManipulationDeltaHandlerで操作される要素は、ユーザーがその特定の要素をクリックまたはタッチしたときにのみ操作できるようにする方法はありますか?UWP操作Delta
私がこれまでに次のコードを持っている:キャンバス上の任意の場所ピンチ/タッチすると
public void AddTextButton_Click(object sender, RoutedEventArgs e)
{
TextBox MyTextBox = new TextBox();
MyTextBox.Background = new SolidColorBrush(Colors.White);
MyTextBox.PlaceholderText = "Text";
MyTextBox.Width = 250;
MyTextBox.Height = 100;
ManipulationMode = ManipulationModes.All;
MyTextBox.RenderTransform = textBoxTransforms;
AddHandler(ManipulationDeltaEvent, new ManipulationDeltaEventHandler(TextBox_ManipulationDelta), true);
parentCanvas.Children.Add(MyTextBox);
}
void TextBox_ManipulationDelta(object sender,
ManipulationDeltaRoutedEventArgs e)
{
dragTextBox.X += e.Delta.Translation.X;
dragTextBox.Y += e.Delta.Translation.Y;
resizeTextBox.ScaleX *= e.Delta.Scale;
resizeTextBox.ScaleY *= e.Delta.Scale;
}
、テキストボックスには、サイズ変更/移動します。これは、ユーザーがテキストボックスの境界内で直接触れる場合にのみ発生します。助言がありますか?
ありがとうございます!
私は覚えていませんが、MyTextBoxでAddHandlerを呼び出すことはできませんか?ように:MyTextBox.AddHandler(..); – rokkerboci
私はこれを試しましたが、何らかの理由でこれがテキストボックスのすべてのドラッグ/リサイズ機能を失います... – kmash