我的问题与描述的这里相同。
我们使用旧的MicrosoftSurface2.0SDK开发了几个应用程序,应用程序构建为AnyCPU,这些应用程序在32位和64位模式下运行都很好。在其中一个应用程序中,我使用ScatterView。
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
Title="MainWindow" Height="350" Width="525">
<Grid>
<s:ScatterView x:Name="timeline">
<Rectangle></Rectangle>
</s:ScatterView>
</Grid>
</Window>但是,如果我试图在一个新的空白ScatterView中添加一个新的Window,则会得到以下错误:
{"The type initializer for 'Microsoft.Surface.Core.InteractiveSurface' threw an exception."}
System.TypeInitializationException was unhandled
HResult=-2146233036
Message=The type initializer for 'Microsoft.Surface.Presentation.Input.InteractiveSurface' threw an exception.
Source=Microsoft.Surface.Presentation
TypeName=Microsoft.Surface.Presentation.Input.InteractiveSurface如果我强迫应用程序在32 bit中运行,它将完美地运行。但是,这个应用程序内存非常密集,所以我也想在64 bit中运行它。
我的问题是:为什么我当前应用程序中的ScatterView可以在64位内完美运行,但是在这个应用程序中添加一个额外的ScatterView或者创建一个brend新应用程序就会立即崩溃。不幸的是,在前面的问题中给出的答案有一个死胡同。
发布于 2015-09-10 07:33:13
当然,经过48小时的搜索,我找到了自己问题的解决方案。
在ScatterView中添加项时,将调用Microsoft.Surface.Presentation.Controls.ScatterCanvas中的函数GetItemOrientation。此函数决定ScatterViewItem的旋转。在64bit中运行应用程序时,此方法将失败并引发异常,这可能是由于调用本机方法来确定它应该在其上运行的SUR40的方向所致。
解决方案:您可以通过自己在ScatterViewItem上设置Orientation属性或通过设置ScatterViewItem.CanRotate = false来禁用对GetItemOrientation的函数调用。
https://stackoverflow.com/questions/32484705
复制相似问题