相关疑难解决方法(0)

app.xaml.cs中的依赖属性

我是WPF的新手,下面的问题可能对很多人来说很傻,请原谅我.

如何在app.xaml.cs中创建依赖项属性?

实际上,我试图创造它.以下代码,

    public static DependencyProperty TempProperty =
       DependencyProperty.Register("Temp", typeof(string), typeof(App));

    public string Temp
    {
        get { return (string)GetValue(TempProperty); }
        set { SetValue(TempProperty, value); }
    }
Run Code Online (Sandbox Code Playgroud)

抛出以下编译时错误:

当前上下文中不存在名称"GetValue"

当前上下文中不存在名称"SetValue"

有人可以帮助我吗?

谢谢!

wpf dependency-properties

7
推荐指数
1
解决办法
9284
查看次数

标签 统计

dependency-properties ×1

wpf ×1