This project has moved. For the latest updates, please go here.

Integrating with Prism Region manager

May 10, 2014 at 9:15 AM
Hi,

I'm attempting to include the map control with the prism region manager, such that I can inject MapItems from other modules.

I've added the map control to a windows and then added a MapItemsControl and made that a region manager
<map:MapItemsControl regions:RegionManager.RegionName="MapItems">
I am able to inject an item, and it displays in the right location, but when zooming the map the item does not scale with it i.e. it moves with the zoom rather than staying on it's location.

Any suggestion on where to look? It's as if the viewport position is not being updated when the zoom changes?

Regards

M
Coordinator
May 10, 2014 at 10:09 AM
Edited May 10, 2014 at 10:14 AM
Did you make sure that the MapItemsControl is a child of the Map control and that the parent-child relationship is kept intact during interaction with Prism's RegionManager?

Either directly by a relation like
<map:Map ...>
    ...
    <map:MapItemsControl ... />
    ...
</map:Map>
or with some intermediate MapPanels.

I've never used Prism, so I'm afraid I can't tell you much here.
May 10, 2014 at 10:58 AM
Hi,

Your code snippet is how I have it. Each MapItem that is injected sets
map:MapPanel.Location={Binding Path=Location}
Asking the question another way, if I added MapItems to an MapItemsControl (which I beleive is derived from listbox), programmatically, is it just enough to add the items, or is additonal steps required ( you mentioned parent-child relationship)

Rgrds

M
Coordinator
May 10, 2014 at 11:45 AM
Adding MapItems to the MapItemsControl while setting their MapPanel.Location property should be sufficient. You might try your code without Prism however.
May 12, 2014 at 7:56 PM
Hi,

Add items programmatically works. I did this in the Map OnLoaded event.

In my own app I debugged the zoom event down to MapPanel.cs:150

The subsequent line #159
element.SetValue(ViewportPositionProperty, viewportPosition); 
doesn't seem to have any effect.
Coordinator
May 12, 2014 at 8:15 PM
The effect of that line is that it sets the value of the ViewportPosition attached property. Nothing more. The actual positioning of the element is done later in the same method, when its RenderTransform property is set.