,我在下面的依賴屬性得到一個錯誤不包含 '的GetValue'
錯誤的定義:
Does not contain a definition for 'GetValue' and no extension method 'GetValue' accepting a first argument of type could be found (are you missing a using directive or an assembly reference?)
我DP:
using System;
using System.Linq;
using System.Windows;
namespace NameSpace
{
public class RadWindowProperties
{
public static readonly DependencyProperty ScreenSubtitleProperty = DependencyProperty.Register("ScreenSubtitle", typeof(string), typeof(RadWindowProperties), new PropertyMetadata(String.Empty));
public string ScreenSubtitle
{
get
{
return (string)this.GetValue(ScreenSubtitleProperty);
}
set
{
this.SetValue(ScreenSubtitleProperty, value);
}
}
}
}
那麼你的'RadWindowProperties'類似乎不是來自任何東西 - 你期望它從哪裏得到一個'GetValue'方法? –
'GetValue'在'DependencyObject'類中定義。 –
是的,我想獲得一個GetValue,所以如果我繼承的DependencyObject是好的?我是WPF的新手。 – user2408987