我创建了一个具有两个静态属性的类:
public class CParametres
{
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
private static Color m_ThemeColorGradientBegin;
public static Color ThemeColorGradientBegin
{
get { return m_ThemeColorGradientBegin; }
set
{
m_ThemeColorGradientBegin = value;
NotifyStaticPropertyChanged("ThemeColorGradientBegin");
}
}
private static Color m_ThemeColorGradientEnd;
public static Color ThemeColorGradientEnd
{
get { return m_ThemeColorGradientEnd; }
set
{
m_ThemeColorGradientEnd = value;
NotifyStaticPropertyChanged("ThemeColorGradientEnd");
}
}
public CParametres()
{
....
}
public void setThemeGradient(Color ColorBegin, Color ColorEnd)
{
ThemeColorGradientBegin = ColorBegin;
ThemeColorGradientEnd = ColorEnd;
}
private static void NotifyStaticPropertyChanged(string propertyName)
{
if (StaticPropertyChanged != null)
{
StaticPropertyChanged(null, new PropertyChangedEventArgs(propertyName));
}
}
}
我的问题是,当我使用 setThemeGradient() 来设置这两个属性时,不会引发通知事件。(这是为了做一个绑定)
有人有想法吗?
非常感谢,
此致,
尼克修斯