I have this xaml code in AvaloniUI:
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:avalonia="clr-namespace:Mapsui.UI.Avalonia;assembly=Mapsui.UI.Avalonia"
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="800"
x:Class="AvaloniaMap.Views.MainWindow"
WindowState="Maximized"
Title="Map">
<ScrollViewer x:Name="MainPanel">
<StackPanel>
<Grid ColumnDefinitions="Auto, Auto, *">
***some stuff here***
<Border Grid.Column="2"
BorderThickness="1"
CornerRadius="4"
Margin="0,4,4,4">
<Grid RowDefinitions="35, *" >
<Border Grid.Row="0" BorderThickness="0"
BorderBrush="Black"
CornerRadius="4,4,0,0"
Height="35">
<Grid VerticalAlignment="Center">
<Label VerticalAlignment="Center" Margin="3,0,0,0">just label</Label>
</Grid>
</Border>
<avalonia:MapControl Grid.Row="1" x:Name="Map"></avalonia:MapControl>
</Grid>
***some stuff here***
</StackPanel>
</ScrollViewer>
</Window>
and this code in C#:
public MainWindow()
{
InitializeComponent();
var mapControl = new MapControl();
mapControl.Map.Layers.Add(Mapsui.Tiling.OpenStreetMap.CreateTileLayer());
var map = this.GetControl<MapControl>("Map");
map.Content = mapControl;
}
Map is shown and zooming works correctly. But panning doesn't work. When I zoom in to map and try to move with "drag and drop" map do nothing. I need to enable moving between map tiles by simply clicking and dragging the mouse. Any ideas to solve this? Thanks.