AnsweredAssumed Answered

Making the MaintainExtentBehavior works

Question asked by vouillas on Jan 18, 2013
Latest reply on Jan 21, 2013 by geonetadmin
Hello,

I have the pretty simple map application below. In the code behind I programmatically add the layers and zoom to a particular extent at startup. The map displays as expected. See images in attachment.
But when I resize the window, the map is not adjusted accordingly.
I tried to remove the width and height properties of the map but it then displays a very tiny image...

I would appreciate any hints toward making this work!

Thanks

Vouillas


<Window x:Class="VaccinationTrackingSystem.MapClient.MainWindow"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        Title="Map" Height ="600" Width ="800" Closing="Window_Closing">
    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition MaxWidth="200" MinWidth="200"/>
        </Grid.ColumnDefinitions>
        <esri:Map x:Name="_map" Grid.Column="0" UseAcceleratedDisplay="False" Width="600" Height="600" HorizontalAlignment="Left" VerticalAlignment="Top">
            <i:Interaction.Behaviors>
                <esri:MaintainExtentBehavior />
            </i:Interaction.Behaviors>
        </esri:Map>
        <esri:MapProgressBar x:Name="MyProgressBar" Grid.Column="0"
            Map="{Binding ElementName=_map}"
            HorizontalAlignment="Center" VerticalAlignment="Bottom"
            Width="150" Height="12"
            Margin="5"  />
        <esri:ScaleLine Grid.Column="0" Map="{Binding ElementName=_map}" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Foreground="Black"/>
        <esri:Navigation Grid.Column="0" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Top"
                         Map="{Binding ElementName=_map}"  />

        <esri:Legend Grid.Column="1" Name="_legend" HorizontalAlignment="Right" VerticalAlignment="Top" ShowOnlyVisibleLayers="True"
               Width="200" Map="{Binding ElementName=_map}">
        </esri:Legend>
    </Grid>
</Window>

Attachments

Outcomes