【发布时间】:2014-05-19 03:47:28
【问题描述】:
我正在尝试将 MapTileSource 的 DataSource 绑定到我的视图模型上的属性,但我在 Maps:MapTileSource 行上收到错误 REGDB_E_CLASSNOTREG(蓝色下划线是 VS 编辑器)。我总是可以使用绑定助手来实现相同的效果(我需要在我的应用程序的 8.0 版本中)但这似乎应该只是......工作。知道有什么问题吗?
<Maps:MapControl Style="{Binding Path=MapStyle}" Center="{Binding Path=MapCenter, Mode=TwoWay}" ZoomLevel="{Binding Path=ZoomLevel, Mode=TwoWay}" MapServiceToken="">
<Maps:MapControl.TileSources>
<Maps:MapTileSource Layer="BackgroundReplacement" DataSource="{Binding Path=BaseLayerDataSource}" />
</Maps:MapControl.TileSources>
</Maps:MapControl>
我也尝试过仅使用具有相同效果的静态数据源:
<Maps:MapControl Style="{Binding Path=MapStyle}" Center="{Binding Path=MapCenter, Mode=TwoWay}" ZoomLevel="{Binding Path=ZoomLevel, Mode=TwoWay}" MapServiceToken="">
<Maps:MapControl.TileSources>
<Maps:MapTileSource Layer="BackgroundReplacement">
<Maps:MapTileSource.DataSource>
<Maps:HttpMapTileDataSource UriFormatString="" />
</Maps:MapTileSource.DataSource>
</Maps:MapTileSource>
</Maps:MapControl.TileSources>
</Maps:MapControl>
编辑:我在http://msdn.microsoft.com/en-us/library/windows/apps/xaml/dn632728.aspx 尝试了示例代码,它运行良好,因此很明显 MapTileSource 本身并未取消注册。但这都是代码隐藏,不使用数据绑定,所以对我来说用处不大。
编辑 2:如果我忽略错误并尝试将应用程序部署到手机模拟器,我会在视图的 InitializeComponent() 上得到这个:
An exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in HikePoint.exe but was not handled in user code
WinRT information: Cannot deserialize XBF metadata type list as '%1' was not found in namespace '%0'. [Line: 0 Position: 0]
Additional information: The text associated with this error code could not be found.
Cannot deserialize XBF metadata type list as '%1' was not found in namespace '%0'. [Line: 0 Position: 0]
If there is a handler for this exception, the program may be safely continued.
【问题讨论】:
-
我猜你还没有找到解决方案?
-
不,我使用了绑定助手,因为我不需要双向。如果你愿意,我可以在我回家时发布代码。
-
很高兴看到您如何规避此错误。我在尝试将源 MediaCapture 绑定到 CaptureElement 时遇到同样的错误。
-
@FrederikKrautwald 您是否能够将源绑定到 CaptureElement。我有同样的问题。
-
@jjthemachine 不,我运气不好。
标签: windows-phone-8.1 win-universal-app mvvm-light bing-maps