Select to view content in your preferred language

Resize WPF mapcontrol

1056
6
Jump to solution
07-31-2012 11:11 AM
Labels (1)
sapnas
by
Frequent Contributor
Is there a sample code to Resize WPF map control? Any help is greatly appreciated.
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor
Hi,

You should take a look at the MaintainExtentBehavior in the ESRI.ArcGIS.Client.Behaviors namespace.

There's a sample in the Sample Application installed with the SDK under Mapping > Behaviors & Actions.

Cheers

Mike

View solution in original post

0 Kudos
6 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

Can you provide some more information about what you would like to achieve? Do you mean allowing the user to resize the map control at runtime, or just having the map control automatically fill the remaining space within your application?

Cheers

Mike
0 Kudos
sapnas
by
Frequent Contributor
Mapcontrol automatically fill the remaining space within the grid when resized. although I resize the grid the map in the map control does not change. I have to manually zoom in to fill the grid.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

If I understand correctly then, you have a grid probably with multiple rows and the map control provides the content for one of these rows. If this is the case then you should just be able to use an asterisk in the grid row size definition to indicate that that row should fill all the remaining available space e.g.

<Grid.RowDefinitions>
    <RowDefinition Height="100" />
    <RowDefinition Height="200" />
    <RowDefinition Height="*"/>
</Grid.RowDefinitions>

...

<esri:Map Grid.Row=2 .../>

Cheers

Mike
0 Kudos
sapnas
by
Frequent Contributor
It fills in during the initial load. But when the user maximizes the application after load the map does not fill in. I'm not sure on how to set the extent.

<Grid Name="grid1"  >
                            <esri:Map x:Name="_map" UseAcceleratedDisplay="False"   Margin="14,7,13,18" >
                              
                            </esri:Map>
</Grid>


private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if ( this.IsLoaded)
            {

                grid1.Height = e.NewSize.Height - 136;
                grid1.Width = e.NewSize.Width - 261;
            }
          
          
        }
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

You should take a look at the MaintainExtentBehavior in the ESRI.ArcGIS.Client.Behaviors namespace.

There's a sample in the Sample Application installed with the SDK under Mapping > Behaviors & Actions.

Cheers

Mike
0 Kudos
sapnas
by
Frequent Contributor
Thanks! That is the solution to my question.
0 Kudos