Sunday, October 26, 2014

Manipulation on TextBox is not that smooth


Can you please explain in more detail what you are doing, and what you mean by the moving and rotating not being smooth? Can you provide a Minimal, Complete, and Verifiable example, exact repro steps, and a clear description of the expected behaviour and how it differs from the actual behaviour?


Manipulation delta will not depend on the specific control.


--Rob



I am adding a TextBox on the Canvas and i want to move and rotate and scale the TextBox with my fingers.


xaml part is like this:



<TextBox Name="txtBox" TextWrapping="Wrap" AcceptsReturn="True"
ScrollViewer.ZoomMode="Disabled"
ScrollViewer.VerticalScrollMode ="Disabled"
ScrollViewer.HorizontalScrollMode ="Disabled"
FontSize="14"
Canvas.ZIndex="0" />


And the code behind is like below:



txtBox.ManipulationMode = ManipulationModes.All;

txtBox.AddHandler(UIElement.TappedEvent, new TappedEventHandler(OnTextBoxTapped), true);
txtBox.AddHandler(UIElement.PointerPressedEvent, new PointerEventHandler(OnTextBoxPointerPressed), true);
txtBox.AddHandler(UIElement.HoldingEvent, new HoldingEventHandler(OnTextBoxfHolding), true);
txtBox.AddHandler(UIElement.ManipulationStartingEvent, new ManipulationStartingEventHandler(CompManipulationStarting), true);
txtBox.AddHandler(UIElement.ManipulationStartedEvent, new ManipulationStartedEventHandler(CompManipulationStarted), true);
txtBox.AddHandler(UIElement.ManipulationDeltaEvent, new ManipulationDeltaEventHandler(CompManipulationDelta), true);
txtBox.AddHandler(UIElement.ManipulationCompletedEvent, new ManipulationCompletedEventHandler(CompManipulationCompleted), true);
txtBox.AddHandler(UIElement.ManipulationInertiaStartingEvent, new ManipulationInertiaStartingEventHandler(CompManipulationInertiaStarting), true);

All those handlers make "Handled" of EventArgs to be false to let the events to be passed up to parent elements.


What i mean not smooth is, on moving or rotating on other elements like rectangle we feel it moves continuously, but for TextBox it just don't move with small distance and a big jump if you move a long distance. It's easy to duplicate it.


No comments:

Post a Comment