1

I have the same issue as described here.

We have developed several applications using the old Microsoft Surface 2.0 SDK. The applications are built as AnyCPU and those work perfectly fine running both in 32 bit and 64 bit mode. In one of these application I use a 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>

However if I try to add a new ScatterView in a new blank Window I get this error:

{"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

If I force the application to run in 32 bit it runs perfectly. However the application is pretty memory intensive so I would like to run it in 64 bit as well.

My question is: How come the ScatterView in my current application runs perfectly in 64 bit, but adding an additional ScatterView to this application or creating a brend new application crashes immediately. Unfortunately the answer given in the previous questions has a dead link.

4

1 回答 1

1

当然,经过 48 小时的搜索,我找到了自己问题的解决方案。

当您在 中添加项目时ScatterView,会调用 中的函数GetItemOrientationMicrosoft.Surface.Presentation.Controls.ScatterCanvas此函数确定ScatterViewItem. 当在此方法中运行您的应用程序64bit失败并引发异常时,可能是由于调用本机方法以确定它应该运行的 SUR40 的方向。

解决方案: 您可以GetItemOrientation通过设置自己的 Orientation属性ScatterViewItem或设置来禁用函数调用ScatterViewItem.CanRotate = false

于 2015-09-10T07:33:13.743 回答