【发布时间】: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