ClemensFischer / XAML-Map-Control

XAML Map Control Library
Microsoft Public License
205 stars 61 forks source link

Map Item Location #24

Closed cdm22 closed 6 years ago

cdm22 commented 6 years ago

It puts the Map Item in the center of the window.
When zooming and panning It does not move with the map.

<DataTemplate     x:Name="SmallPin">
            <Grid
                    Width="150"
                    Height="110"
                    x:Name="PinGrid"

                    Tapped="Grid_Tapped"
                    Tag="{Binding ID}">

                <Polygon
                        Points="0,80  150,80  150,100  90,100  75,110  60,100  0,100"
                        Stroke="{Binding TextColor}"
                        StrokeThickness="1">
                    <Polygon.Fill>
                        <SolidColorBrush
                                Color="{Binding Color}"
                                Opacity="0.7" />
                    </Polygon.Fill>
                </Polygon>

                <Viewbox
                        Height="15"
                        Width="150"
                        Margin="0,80,0,0"
                        VerticalAlignment="Top">

                    <TextBlock
                            x:Name="textBlock"
                            TextWrapping="NoWrap"
                            Foreground="{Binding TextColor}"
                            FontSize="20"
                            Text="{Binding Name}"
                            VerticalAlignment="Top"
                            HorizontalAlignment="Center" />

                </Viewbox>
            </Grid>
        </DataTemplate>

<map:MapItemsControl
                    x:Name="mapItems"
                    ItemTemplate="{StaticResource SmallPin}">
                <Style
                        TargetType="map:MapItem">
                    <Setter
                            Property="local:BindingHelper.LocationPath"    (Tried this)
                            Property="map:MapPanel.Location"                  (and this)
                            Value="{Binding Location}" />
                </Style>
            </map:MapItemsControl>

image

ClemensFischer commented 6 years ago

You have added a Style element as item to an ItemsControls. This won't work. Please read up about XAML basics, and take a closer look at the MapControl sample applications.