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

1289
1
04-25-2017 11:20 AM
WilliamWhite1
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
GregDeStigter
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"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
        xmlns:local="clr-namespace:GridSplitterTest.WPF"
        mc:Ignorable="d" Title="GridSpliter Map Test">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <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="http://www.arcgis.com/home/webmap/viewer.html?webmap=d5e02a0c1f2b4ec399823fdd3c2fdebd" />
        <TextBlock Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="12" Padding="4" 
                   Background="White" Text="{Binding ElementName=MyMapView, Path=MapScale, StringFormat=N0}" />
    </Grid>
</Window>

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.