I have a WPF app with a Grid with 2 columns.
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
In column 1 there is a user control (WorkContentUC) that has variable content, and is actually collapsed at startup.
In column 2 there is a user control (MapUC) that contains a MapView.
When WorkContentUC.Visibility is changed to Visible, the MapView changes size and re-centers with respect to the new size.
My problem is that the re-centering is "instant" and the map appears to jump. How do I "slow it down"?
I have added a handler to MapView.SizeChanged to SetViewpointAsync with a duration of 3 seconds but it does not have any effect:
MainMapView.SizeChanged += HandleMapViewSizeChanged;
...
private async void HandleMapViewSizeChanged(object sender, SizeChangedEventArgs e)
{
var currentViewpoint = MainMapView.GetCurrentViewpoint(ViewpointType.CenterAndScale);
if (currentViewpoint is null)
{
return;
}
await MainMapView.SetViewpointAsync(currentViewpoint, TimeSpan.FromSeconds(3));
}