This is exactly what I'm doing.Geography Changed Handler.Messenger.Default.Register<PropertyChangedMessage<NavigableGeography>>(
this,
action =>
{
if (action.NewValue.Extent != null)
{
if(MaxExtent == null)
MaxExtent = MapLayers["Base Map"].FullExtent;
ConstrainedExtent = MaxExtent;
Extent = action.NewValue.Extent.Expand(1.25);
ConstrainedExtent = Extent;
}
});
XAML <!-- Map -->
<esri:Map x:Name="map"
ext:AttachedProperties.BindableExtent="{Binding MapVM.Extent}"
Background="White" SnapToLevels="True" d:IsHidden="True"
IsLogoVisible="False" Layers="{Binding MapVM.MapLayers}" >
<i:Interaction.Behaviors>
<esri:ConstrainExtentBehavior ConstrainedExtent="{Binding MapVM.ConstrainedExtent, Mode=OneWay}" />
</i:Interaction.Behaviors>
</esri:Map>
This code snippet is in a ViewModel I created for the map. MaxExtent, Extent and ConstrainedExtent are all properties of the ViewModel that raise PropertyChanged events.When the application first loads, everything is fine. I can pan and zoom. The ConstrainedExtent is null because the "Base Map" hasn't loaded yet.When the user chooses a geography to zoom to, the MaxExtent is populated and the ConstrainedExtent is set to that.I then do the zoom by changeing the Extent property of the ViewModel and set the new ConstrainedExtent to the current Extent.I have verified that all the values are set correctly in the ViewModel.The only thing I am wondering about is what happens when the extent is not the same width:height ratio as the screen? Could something be going on with that?As stated above, the expected behavior would be that panning to the edges would produce the "bounce" effect and that I could zoom in, but not out farther than the ConstrainedExtent.I do not get the bounce effect nor can I zoom in or out. I am just locked to that extent.If I then select to zoom to a different geography, it allows me, but I get the same behavior at the new extent. Can't pan or zoom.