Using a WPF grid control to contain the map. The grid control contains one row and three columns. The first column contains other data, the second contains a GridSplitter and the third contains the map. If I move the splitter to the left row one all the c

04-25-2017 11:20 AM
New Contributor

In the XAML I have defined a grid with three columns and one row. The first column contains data, the second a gridsplitter and the third the map control. If I move the slider to the left toward the first column I can see the columns adjust their size. If I attempt to move it toward the right the splitter does not move and the column are not resized. The splitter is highlight so I know it is getting focus. I see the double arrow showing the splitter going into the map column but again the columns are not adjusting width as I expect and the splitter does not move. It look like the map control will increase in size if its container control size is increased but will not decrease if the container control is decreased. I'm see the same behavior if I expand my main application to span the width of my two screen and then display the map, if I size my application window to fit a single screen the map does not change size.  Is this expected behavior or do I have a map property set correctly? Using the map control without any properties set in the XAML. 

0 Kudos
1 Reply
Esri Contributor

I tried to reproduce this with API version 100.0 (not sure what version you were using) and things seemed to work as I expected. Here's my test XAML:

<Window x:Class="GridSplitterTest.WPF.MainWindow"
        mc:Ignorable="d" Title="GridSpliter Map Test">
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        <Border Grid.Column="0" Background="Blue" />
        <GridSplitter Grid.Column="1" Width="4" Background="Black"
                      HorizontalAlignment="Center" VerticalAlignment="Stretch"/>
        <esri:MapView Grid.Column="2" x:Name="MyMapView"
                      Map="" />
        <TextBlock Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="12" Padding="4" 
                   Background="White" Text="{Binding ElementName=MyMapView, Path=MapScale, StringFormat=N0}" />

Note that when a MapView is resized the map scale and center point are preserved and not necessarily the visible extent. This may or may not be what you expect. I added the a TextBlock that displays the map scale so you can see what I mean.