0

在 WPF 浏览器应用程序中使用我制作的 WPF 用户用户控件库时,我遇到了这个问题。

我将其添加到页面如下,并将对我的用户控件的引用添加到项目中

<Page x:Class="Page1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  xmlns:tools="clr-namespace:Visualisation;assembly=Visualisation"
  mc:Ignorable="d" 
  d:DesignHeight="600"
  d:DesignWidth="1100"
  Title="Page1">
<Grid Name="main">
    <tools:uc3dview Name="_View"></tools:uc3dview>
</Grid>
</Page>

我收到以下错误。

System.Reflection.TargetInvocationException was unhandled
Message: Exception has been thrown by the target of an invocation.

如果我在 WPF 应用程序中使用这个精确的用户控件,我没有问题。

我是否缺少一些构造函数符号,所以我的用户控件库可以在 WPF 应用程序中工作,更重要的是在 WPF 浏览器应用程序中工作。如果这很重要,我正在使用 Visual Studio 2012。

提前致谢。

4

1 回答 1

0

我终于弄明白了。用户控件在其控件之一上具有投影效果。

<ScrollViewer.Effect>
            <DropShadowEffect/>
</ScrollViewer.Effect>

因为这个 xbap 浏览器应用程序在部分信任模式下运行。当控件去获得授权做阴影效果时,错误被提出。

在完全信任的情况下运行浏览器应用程序或只是注释掉阴影效果,可以解决问题。

如果有人可以更好地解释它。请继续。

于 2013-02-26T04:14:57.727 回答