-
On Mobile devices, it is expected that dragging the screen content scrolls the view (and even has momentum, allowing you to flick-throw the content, which continues and decelerates after the flick). Is this type of behavior already planned for this year as a "base behavior option" of Avalonia? Or will we need to make some sort of Custom Behavior to make it work like this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
ScrollViewer enables touch-based scrolling out of the box. You can enable it for custom controls by adding Avalonia/src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml Lines 39 to 43 in fed6363 |
Beta Was this translation helpful? Give feedback.
-
Just a note to anyone reading this too. public class TapScrollableButton : Button, IStyleable
{
Type IStyleable.StyleKey => typeof(Button);
protected override void OnPointerPressed(PointerPressedEventArgs e)
{
base.OnPointerPressed(e);
//Allow ScrollViewer handle touch scroll
e.Handled = false;
}
} If anyone knows better implementation for my case, just tell me, I'm still new to avalonia. |
Beta Was this translation helpful? Give feedback.
ScrollViewer enables touch-based scrolling out of the box. You can enable it for custom controls by adding
ScrollGestureRecognizer
like this:Avalonia/src/Avalonia.Themes.Fluent/Controls/ScrollViewer.xaml
Lines 39 to 43 in fed6363