我是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"
有人可以帮助我吗?
谢谢!