AnsweredAssumed Answered

MapView in ContentPresenter bug?

Question asked by bsundsbo on Apr 22, 2015
Latest reply on Jun 11, 2015 by bsundsbo

Hi,

 

While playing around with the MVVM approach for the controls, I discovered something I believe is a bug. I was trying to display multiple viewmodels where the DataTemplate contains a MapView in an itemscontrol (TabControl), I discovered that the map is not displayed. I get an empty map, which is of no real use. It is just an empty control with the ESRI logo. I get the same result using a ContentPresenter.

 

The following should be sufficient to reproduce. SomeClass is just an empty class in this example. Having a map property on this class, and binding the MapView.Map to that property doesn't work either.

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width=".5*" />
        <ColumnDefinition Width=".5*" />
    </Grid.ColumnDefinitions>
    <esri:MapView Grid.Column="0">
    <!-- This map works -->
        <esri:Map>
            <esri:ArcGISTiledMapServiceLayer ID="h" ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
        </esri:Map>
    </esri:MapView>
    <ContentPresenter Grid.Column="1">
    <!-- This map does not work -->
        <ContentPresenter.ContentTemplate>
            <DataTemplate DataType="viewModels:SomeClass" >
                <esri:MapView>
                    <esri:Map>
                        <esri:ArcGISTiledMapServiceLayer ID="h" ServiceUri="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
                    </esri:Map>
                </esri:MapView>
            </DataTemplate>
        </ContentPresenter.ContentTemplate>
        <ContentPresenter.Content>
            <viewModels:SomeClass />
        </ContentPresenter.Content>
    </ContentPresenter>
</Grid>

I have to admit that this is rather inconvenient for what I need to do in my application, so I was wondering if there is a suggested workaround, and if this is possible to fix somewhat shortly?

Outcomes