XAML 中的属性 Duration 不允许值类型 Duration [英] Value Type Duration is not allowed on property Duration in XAML

查看:32
本文介绍了XAML 中的属性 Duration 不允许值类型 Duration的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用普通的 Windows Metro 风格应用程序执行以下操作:

I am trying to do the following with an ordinary Windows Metro style application:

public class MyButton : Button
{
    public Duration Duration { get; set; }
}

<Grid>
    <local:MyButton Duration="0:0:0.2" />
</Grid>

但我收到错误消息:XAML 中的属性 Duration 不允许使用值类型持续时间

知道我做错了什么吗?任何帮助将不胜感激.

Any idea what I might be doing wrong? Any help would be greatly appreciated.

推荐答案

这是 Visual Studio 11 Beta XAML 编译器中的一个错误.不能通过 XAML 设置用户定义的值类型属性.

This is a bug in the Visual Studio 11 Beta XAML compiler. You cannot set user-defined value type properties via XAML.

此错误已修复,下一个版本的 Visual Studio 11 中应包含此修复程序.

This bug has been fixed and the fix should be present in the next release of Visual Studio 11.

这篇关于XAML 中的属性 Duration 不允许值类型 Duration的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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