XAML-Map-Control: Ellipses do not scale with zoom in WPF sample
Hi and thank you for this repo,
When zooming, ellipses defined in a MapItemsControl do not appear to scale with the zoom level. As you zoom out they get bigger instead of smaller. This is the opposite behavior of a statically defined ellipse, which correctly scales (gets smaller) as you zoom out:
For instance, this works as described above (from your WPF sample app):
<map:MapPath Location="53.5,8.2" Stroke="Blue" StrokeThickness="3" Fill="#1F007F00">
<map:MapPath.Data>
<EllipseGeometry RadiusX="1852" RadiusY="1852"/>
</map:MapPath.Data>
</map:MapPath>
But this doesn’t work; Extending your WPF Sample, I display an ellipse for each point location you’ve defined. They display perfectly fine, but as you zoom out they get bigger (whereas static ellipse stays a fixed size)
<Style x:Key="EllipseItemStyle" TargetType="map:MapItem">
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="map:MapItem">
<Canvas>
<map:MapPath Fill="Red" Opacity="0.7">
<map:MapPath.Data>
<EllipseGeometry RadiusX="100" RadiusY="100"/>
</map:MapPath.Data>
</map:MapPath>
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
And then beside the other mapcontrols:
<map:MapItemsControl ItemsSource="{Binding Points}"
ItemContainerStyle="{StaticResource EllipseItemStyle}"
SelectionMode="Extended"/>
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (10 by maintainers)
There is now a read-only MapTransform property in the MapItem class, which scales and rotates from map to view coordinates.
It may be used like this:
@YiehraiS Forgot a commit or push last night. Will do later. For the scale bar, see the MapScale class.