【问题标题】:WP7 Bing map in popup弹出窗口中的 WP7 Bing 地图
【发布时间】:2010-10-20 07:08:10
【问题描述】:

我正在开发一个 WP7 演示应用程序,并让我的弹出窗口与 static resources 一起工作,我之前遇到了问题。现在,当这不碍事时,我遇到了一个关于我使用 Bing 地图的新错误。

在我的默认 WP7 Silverlight 页面(全景或常规)中使用 bing 地图时,地图显示正常,但在我的静态资源布局中使用 bing 地图时,地图本身只是显示为黑色。

地图周围的控件(例如具有缩放和地图模式的导航窗格)显示正常,bing 地图徽标和距离参考线也显示正常,但地图图像只是纯黑色(透明,因为我的弹出窗口的背景是黑色的)。

有人遇到过这种情况吗?

我在帖子中发现此问题发生在默认 silverlight 页面(一些签名程序集错误)中,因此我尝试使用未签名程序集进行修复,但后来我的 WP7 应用程序没有启动。

*编辑 我的弹出资源 XAML 代码如下所示。

<ResourceDictionary xmlns:my="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Skanetrafiken.Controls;assembly=Skanetrafiken.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    >
    <Style TargetType="local:MapRouteDialog">
        <Setter Property="Background" Value="{StaticResource PhoneChromeBrush}"/>
        <Setter Property="Width" Value="480"/>
        <Setter Property="Height" Value="800"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:MapRouteDialog">
                    <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}" Margin="0, 0, 0, 0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>

                        <!--TitlePanel contains the name of the application and page title-->
                        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,30,0,40">
                            <TextBlock x:Name="DialogTitle" Text="MY DIALOG TITLE" Style="{StaticResource PhoneTextNormalStyle}"/>
                        </StackPanel>
                        <my:Map x:Name="RouteMap" Grid.Row="1" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  NavigationVisibility="Visible">
                            <Button x:Name="ButtonZoomIn" HorizontalAlignment="Left" VerticalAlignment="Top" Height="56" Width="56" Margin="8,180,0,0" BorderBrush="{x:Null}" Foreground="{x:Null}">
                                <Button.Background>
                                    <ImageBrush ImageSource="/Skanetrafiken.Controls;component/images/Zoom_In.png" />
                                </Button.Background>
                            </Button>
                            <Button x:Name="ButtonZoomOut" HorizontalAlignment="Left" VerticalAlignment="Top" Height="56" Width="56" Margin="8,260,0,0" BorderBrush="{x:Null}" Foreground="{x:Null}">
                                <Button.Background>
                                    <ImageBrush ImageSource="/Skanetrafiken.Controls;component/images/Zoom_Out.png" />
                                </Button.Background>
                            </Button>
                            <my:MapLayer Name="RouteLines"></my:MapLayer>
                            <my:MapItemsControl Name="PushPins"/>
                        </my:Map>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

显示地图不需要代码,此 xaml 可在标准 silverlight WP7 页面中使用,但在用于此类资源时则无法使用。当这样使用时,地图图像/内容将丢失且透明。

【问题讨论】:

  • 未签名的程序集问题指的是CTP版本的工具。
  • 我正在使用 Microsoft Windows Phone 开发工具 - ENU,就像我说的那样,它对我的​​问题没有任何影响。
  • 你能发布一些 XAML/代码吗?
  • 编辑了我的帖子并为我使用地图的资源添加了 XAML。

标签: silverlight popup windows-phone-7 bing-maps


【解决方案1】:

很抱歉成为派对的垃圾,但你可能会受到这个真相的影响:

http://blogs.claritycon.com/blogs/kevin_marshall/

弹出窗口中的内容不是硬件 加速。如果你尝试制作动画 弹出窗口中的东西,它会很慢。如果 你需要模仿弹出窗口 功能,考虑重新模板 PhoneApplicationFrame 来包装 contentpresenter 在网格中并放置一个 其下方的 contentpresenter 充当 假弹出窗口的占位符。你可以 然后写一个弹出管理器插入 无论您以前在 弹出到内容演示者/假 弹出。这让你有更好的 对弹出窗口中的内容进行 perf 和 你可以有更流畅的动画 滑动/翻转弹出窗口 地点。

【讨论】:

  • 查看您的代码,您似乎并没有普遍使用术语弹出窗口,而不是实际使用弹出窗口控件。对不起。
【解决方案2】:

将弹出窗口添加到可视树(页面的任何子控件)应该可以解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多