在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,如果这很重要的话。
提前谢谢。
发布于 2013-02-26 12:14:58
我终于想通了。用户控件在其一个控件上具有投影效果。
<ScrollViewer.Effect>
<DropShadowEffect/>
</ScrollViewer.Effect>因为此xbap浏览器应用程序在部分信任模式下运行。当控件去获得做投影效果的授权时,错误被抛出。
在完全信任的情况下运行浏览器应用程序,或者只是注释掉投影效果,就可以解决这个问题。
如果有人能更好地解释的话。请继续。
https://stackoverflow.com/questions/15058123
复制相似问题