WinRT -缩略图代替必应地图控件

本文关键字:地图 控件 略图 WinRT | 更新日期: 2023-09-27 18:06:27

在一个windows商店项目中,我有一个创建了几个大方块的页面,格式如下

<DataTemplate x:Key="MyMeetingsWithMapSquares">

        <Grid Width="350" Height="290" DataContext="{Binding}" >
            <StackPanel >
                <StackPanel.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0,1"  >
                        <GradientStop Color="#FF0072C6" Offset="0"/>
                        <GradientStop Color="#FF008FD4" Offset="1"/>
                    </LinearGradientBrush>
                </StackPanel.Background>
                <Grid DataContext="{Binding}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="90"/>
                        <RowDefinition Height="60"/>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="150"/>
                    </Grid.RowDefinitions>
                    <Border BorderBrush="#0166a0" BorderThickness="0,0,0,1" Margin="10,0,10,0">
                        <StackPanel Grid.Row="0">
                            <Grid DataContext="{Binding}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="220"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Grid Grid.Column="0">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="50"/>
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Grid.Row="0" Margin="0,16,0,0" Text="{Binding MyMeetingSquareDayNumber}" Width="40" FontFamily="Segoe UI Semibold" FontSize="33" FontWeight="SemiBold" VerticalAlignment="Top"/>
                                        <TextBlock Grid.Row="0" Margin="0,16,0,0" Text="{Binding MyMeetingSquareMonthText}" Width="60" FontFamily="Segoe UI Regular" FontSize="33" FontWeight="Normal" VerticalAlignment="Top"/>
                                        <TextBlock Grid.Row="0" Margin="0,16,0,0" Text="{Binding MyMeetingSquareYearText}"  Width="60" FontFamily="Segoe UI Light" FontSize="33" FontWeight="Light" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                                    </StackPanel>
                                    <TextBlock Grid.Row="1" Margin="0,5,0,0" Text="Business meeting" FontFamily="Segoe UI Semibold" FontSize="24" FontWeight="SemiBold" VerticalAlignment="Center"/>
                                </Grid>
                                <StackPanel Grid.Column="1" VerticalAlignment="Center">
                                    <TextBlock Text="{Binding MyMeetingSquareDayHour}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                </StackPanel>
                            </Grid>
                        </StackPanel>
                    </Border>
                    <Border Grid.Row="1" BorderBrush="#0166a0" BorderThickness="0,0,0,1" Margin="10,0,10,0">
                        <StackPanel >
                            <TextBlock Text="{Binding MyMeetingSquareSummary}" FontFamily="Segoe UI Light" FontSize="16" Margin="0,10,0,10" TextWrapping="Wrap"/>
                        </StackPanel>
                    </Border>
                    <StackPanel Grid.Row="2">
                        <Border BorderBrush="#0166a0" BorderThickness="0,0,0,1" Margin="10,0,10,0">
                            <ScrollViewer VerticalScrollBarVisibility="Hidden" VerticalScrollMode="Disabled" HorizontalScrollBarVisibility="Hidden" HorizontalScrollMode="Enabled">
                                <GridView  ItemContainerStyle="{StaticResource GridViewItemStyle2}" ItemsSource="{Binding MyMeetingsSquareUsers}"  ItemTemplateSelector="{StaticResource meetingSelector}" Grid.Row="1" Margin="0,10,0,0"  SelectionMode="None" HorizontalContentAlignment="Left" VerticalContentAlignment="Bottom">
                                    <GridView.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <ItemsWrapGrid Orientation="Vertical" MaximumRowsOrColumns="1"/>
                                        </ItemsPanelTemplate>
                                    </GridView.ItemsPanel>
                                </GridView>
                            </ScrollViewer>
                        </Border>
                    </StackPanel>
                    <StackPanel Grid.Row="3" Height="150" DataContext="{Binding}" Background="Red">
                        <Grid  Tapped="Map_DoubleTappedOverride">
                            <StackPanel Height="55" Width="190" Canvas.ZIndex="11" Margin="10,0,0,60" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Vertical">
                                <StackPanel.Background>
                                    <ImageBrush Stretch="Uniform" ImageSource="ms-appx:///Images/Meetings/meetingAddress.png"/>
                                </StackPanel.Background>
                                <ScrollViewer HorizontalScrollBarVisibility="Disabled" HorizontalScrollMode="Disabled" VerticalScrollBarVisibility="Hidden"  Width="175" Margin="5,0,0,0" Height="50" VerticalAlignment="Center" HorizontalAlignment="Center" >
                                    <TextBlock Text="{Binding Address}" Margin="10,0,0,0" FontFamily="Segoe UI Semilight" FontSize="14" Foreground="Black" Width="170" TextWrapping="WrapWholeWords" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </ScrollViewer>
                            </StackPanel>
                            <Maps:Map x:Name="miniMap" Tag="{Binding MyMeetingSquareLat}" Loaded="Map_Loaded" DataContext="{Binding}" ZoomLevel="15" Margin="0,10,0,0"   ShowBreadcrumb="False" Height="150" ShowNavigationBar="False"  ShowScaleBar="False" ShowTraffic="True" ShowBuildings="True" Width="350" Credentials="AnZKLHgAfKSwa5BAB2Kr-g8KENJBm1US3tVieyOxxxxxxxJZVXyUgRIwM"  >
                                <Maps:Map.Children>
                                    <Maps:Pushpin Foreground="{x:Null}">
                                        <Maps:Pushpin.RenderTransform>
                                            <CompositeTransform />
                                        </Maps:Pushpin.RenderTransform>
                                        <Maps:Pushpin.Background>
                                            <ImageBrush Stretch="Fill" ImageSource="ms-appx:///Images/Meetings/meetingsPushpin.png"/>
                                        </Maps:Pushpin.Background>
                                        <Maps:MapLayer.Position>
                                            <Maps:Location  Latitude="{Binding MyMeetingSquareLat}" Longitude="{Binding MyMeetingSquareLng}" />
                                        </Maps:MapLayer.Position>
                                    </Maps:Pushpin>
                                </Maps:Map.Children>
                            </Maps:Map>
                        </Grid>
                    </StackPanel>
                </Grid>
            </StackPanel>
        </Grid>
    </DataTemplate>

我的问题是,我有性能问题,主要是一些高内存使用。如果我从模板中删除Map部分,内存使用将下降到1/4。

我的问题是,如果Bing地图有某种拇指预览,或者我如何用地图上图钉位置的图像替换我的地图。在同一页面上放置一堆映射控件似乎会影响性能。

WinRT -缩略图代替必应地图控件

是的,它叫做Bing Maps REST静态图像服务:https://msdn.microsoft.com/en-us/library/ff701724.aspx