I am using MapControl(MapsUI) in ScrollViewer in my AvaloniaUI 11.0.5. app. I need to disable scrolling in ScrollViewer while pointer is in MapControll. I have tried this code but it did not work:
AXAML:
<ScrollViewer Name="mainPanel">
...
<Panel PointerEntered="disableScroll" PointerExited="enableScroll" Name="MapBox" /> //here is MapControl added later in code
...
///some very big stuff here like Panels, TextBoxes, Images etc.
...
</ScrollViewer>
c#:
private void disableScroll(object o, PointerEventArgs e)
{
mainPanel.VerticalScrollBarVisibility = Avalonia.Controls.Primitives.ScrollBarVisibility.Disabled;
}
private void enableScroll(object o, PointerEventArgs e)
{
mainPanel.VerticalScrollBarVisibility = Avalonia.Controls.Primitives.ScrollBarVisibility.Auto;
}
Maybe is there some pre-scroll event? Any ideas please?
After very long time I found a solution.
I created function:
and and assigned it to MapControl in axaml:
Now I can zoom in and out the Map without scrolling the ScrollViewer at the same time.