2013-02-24 80 views
0

当我在WPF浏览器应用程序中使用WPF用户用户控件库时遇到此问题。WPF用户控件库WPF浏览器应用程序中的XAML错误

我把它添加到页面如下,并添加了参考我的用户控件添加到项目

<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,如果这很重要。

在此先感谢。

+0

控制工具:uc3dview可以在部分信任下运行吗?你可以在这里阅读http://MSdn.microsoft.com/en-gb/library/aa970060.aspx – Andy 2013-02-25 06:50:16

+0

@安迪谢谢你的提示。这是解决问题的关键。 – Scott 2013-02-26 04:15:38

回答

0

我终于明白了。 用户控件对其控件之一有一个阴影效果。

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

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

运行完全信任的浏览器应用程序或只是注释掉阴影效果,可以修复问题。

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