行为 SDK - ChangePropertyAction 在使用 .net native 编译时在运行时生成参数异常 [英] Behavior SDK - ChangePropertyAction generates argument exception in runtime when compiling with .net native

查看:17
本文介绍了行为 SDK - ChangePropertyAction 在使用 .net native 编译时在运行时生成参数异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Behaviors SDK 中的 DataTrigerBehavior 根据其他属性的值更改 System.Windows.Shapes.Path.Data 属性,这是我代码的一部分:

I'm using DataTrigerBehavior from Behaviors SDK to change System.Windows.Shapes.Path.Data property according to the value of other propery, this is a part of my code:

 <Path x:Name="ItemPath" Stretch="Uniform" Grid.Column="0" Fill="#FF646464" Stroke="{x:Null}" StrokeThickness="3"> 
   <Interactivity:Interaction.Behaviors>
     <Core:DataTriggerBehavior Binding="{Binding FType, Converter={StaticResource EnumToStringConverter}}" Value="Parent"> 
       <Core:ChangePropertyAction TargetObject="{Binding ElementName=ItemPath}" PropertyName="Data" Value="M15,6H8V3c0-0.484-0.375-1-1-1C6.539,2,6.305,2.287,6,2.54L0.625,7C0.242,7.313,0,7.555,0,8s0.242,0.688,0.625,1L6,13.46  C6.305,13.713,6.539,14,7,14c0.625,0,1-0.516,1-1v-3h7c0.55,0,1-0.45,1-1V7C16,6.45,15.55,6,15,6z"/>
     </Core:DataTriggerBehavior>
  </Interactivity:Interaction.Behaviors>
</Path>

当我没有使用 .net native 工具链编译项目时它工作正常,但是在使用 .Net native 编译项目后,我在运行时遇到了一个参数异常.

It works fine while I'm not compiling project with .net native toolchain, but after compiling project with .Net native I'm getting an argument exception in runtime.

这是一个例外详情:

抛出异常:Microsoft.Xaml.Interactions.dll 中的System.ArgumentException"

Exception thrown: 'System.ArgumentException' in Microsoft.Xaml.Interactions.dll

附加信息:在类型 Path 上找不到名为 Data 的属性.

Additional information: Cannot find a property named Data on type Path.

为什么在Path类中找不到Data属性?

Why could not be found Data property in the Path class?

你能帮我吗?

推荐答案

Behaviors SDK 和 .NET Native 似乎存在一些已知和报告的问题.

There seem to be some problems with Behaviors SDK and .NET Native that are already known and reported.

以下是来自 Connect 错误报告的引用:

Here's a quote from Connect bug report:

当您在发行版中运行时,您是在 .NET Native 运行时下运行的.这里要注意的一件事是 ChangePropertyAction 在应用程序执行期间使用反射来了解您尝试在元素上设置的属性和值.为了使反射在 .NET Native 运行时中的这些情况下成功工作,您需要使用您尝试访问的属性的类型信息更新 default.rd(默认情况下位于项目的 Properties 文件夹中).在这种情况下,您可以通过在 default.rd 中添加以下行来解决此问题.

<Type Name="Windows.UI.Xaml.Shapes.Shape" Dynamic="Required Public" />

请注意,您需要对项目中 ChangePropertyAction 引用的其他类型执行上述操作.

来源:发布模式 UWP 应用程序中的 ChangePropertyAction 发生异常

这篇关于行为 SDK - ChangePropertyAction 在使用 .net native 编译时在运行时生成参数异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆