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?
I was able to create a partially workaround by putting my MapView inside of a UserControl (MapViewHost), and reference <MapViewHost/> in the DataTemplate.
Not sure why this works, but it could be related to what happens inside of InitializeComponents?
Is this something that will be addressed in the future, Michael Branscomb? I've gotten it sorted out for now, but it would be practical to be able to avoid such a workaround, even if I believe I would have ended up with a similar solution eventually, as I would have wanted to separate the map UI.
However, this does NOT work when the map is created in my viewmodel, and bound to the MapView. If I do I get an empty map grid, operations work, legend and scale line displays as they should, adding features work, but the map itself is not rendered.
Any information from ESRI on this topic?
Hey,
Do you have a repro for this so I can have a look?
cheers,
Antti
I have attached screenshot and Reproducable example to the previous post
I didn't see attachement on the view earlier. I'll have a look.
I can get this reproduced and created new issue for this.
The attachment was added after you requested it, so it is reasonable that you did not see it before.
Great that you have been able to reproduce. When you resolve the issue, a possible workaround I can use until the release of the bugfix, that would be greatly appreciated.