【问题标题】:How to use a custom class in XAML?如何在 XAML 中使用自定义类?
【发布时间】:2010-11-24 10:25:59
【问题描述】:

我有以下课程,

internal class PageInformation
{
    public string Name
    {
        get;
        set;
    }
    public Uri PageUri
    {
        get;
        set;
    }
}

如何在 XAML(页面)中使用它并为其属性赋值?

更新 1:

我在页面标签中添加了 xmlns 属性

并从 DependencyObject 继承 PageInformation(具有依赖属性)。

XAML 仍然无法识别 PageInformation 类

【问题讨论】:

    标签: wpf xaml


    【解决方案1】:

    我试图在 Canvas 中使用 PageInformation 元素。由于它不是 UIElement,我认为,它不能在那里添加。

    我可以将其用作资源元素(在 Page.Resources 中):)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      • 1970-01-01
      • 1970-01-01
      • 2017-03-14
      • 2011-03-30
      • 2013-07-15
      相关资源
      最近更新 更多