【问题标题】:Value Type Duration is not allowed on property Duration in XAMLXAML 中的属性持续时间不允许值类型持续时间
【发布时间】:2012-04-03 13:58:45
【问题描述】:

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

public class MyButton : Button
{
    public Duration Duration { get; set; }
}
<Grid>
    <local:MyButton Duration="0:0:0.2" />
</Grid>

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

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

【问题讨论】:

    标签: xaml visual-studio-2012 windows-runtime windows-store-apps winrt-xaml


    【解决方案1】:

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

    此错误已修复,该修复应该会出现在 Visual Studio 11 的下一版本中。

    【讨论】:

      【解决方案2】:

      目前我的解决方法是将我的持续时间属性公开为字符串...

      【讨论】:

        猜你喜欢
        • 2018-03-31
        • 2013-04-07
        • 1970-01-01
        • 2020-09-24
        • 2018-05-06
        • 1970-01-01
        • 2020-05-20
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多