C# WPF将控件绑定到静态对象[]数组数据(.NET 4.5)

C# WPF将控件绑定到静态对象[]数组数据(.NET 4.5),c#,.net,wpf,data-binding,C#,.net,Wpf,Data Binding,我有一个静态对象[]数组(500多个项),每秒都会更改,还有许多控件需要显示此数组中包含的数据。我需要这个数组是静态的,因为它在许多其他类中使用 有可能在.NET4.5中实现这样的绑定吗?我正在尝试下面的代码,但没有成功(基于)。我在编译时遇到“Playback.Control”未实现接口成员“System.ComponentModel.INotifyPropertyChanged.PropertyChanged”错误 public class Control : INotifyProperty

我有一个静态对象[]数组(500多个项),每秒都会更改,还有许多控件需要显示此数组中包含的数据。我需要这个数组是静态的,因为它在许多其他类中使用

有可能在.NET4.5中实现这样的绑定吗?我正在尝试下面的代码,但没有成功(基于)。我在编译时遇到“Playback.Control”未实现接口成员“System.ComponentModel.INotifyPropertyChanged.PropertyChanged”错误

public class Control : INotifyPropertyChanged
{
    public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
    public static void RaiseChangeEvent(string propName)
    {
        EventHandler<PropertyChangedEventArgs> handler = StaticPropertyChanged;
        if (handler != null)
        handler(null, new PropertyChangedEventArgs(propName));
    }

    private static int _playposition;
    public static int PlayPosition { get { return _playposition; } set { if (_playposition == value) return; _playposition = value; RaiseChangeEvent("PlayPosition"); } }

    public static DataTable JobData { get; private set; }

    private static Object[] _currentdata;
    public static Object[] CurrentData { get { return _currentdata; } set { if (_currentdata == value) return; _currentdata = value; RaiseChangeEvent("CurrentData"); } }

    private static Object[] _previousdata;
    public static Object[] PreviousData { get { return _previousdata; } set { if (_previousdata == value) return; _previousdata = value; RaiseChangeEvent("PreviousData"); } }
}
公共类控件:INotifyPropertyChanged
{
公共静态事件EventHandler StaticPropertyChanged;
公共静态void RaiseChangeEvent(字符串propName)
{
EventHandler=StaticPropertyChanged;
if(处理程序!=null)
处理程序(null,新属性changedeventargs(propName));
}
专用静态int_播放位置;
public static int PlayPosition{get{return}u PlayPosition;}set{if(_PlayPosition==value)return;_PlayPosition=value;RaiseChangeEvent(“PlayPosition”);}
公共静态数据表JobData{get;private set;}
私有静态对象[]_currentdata;
公共静态对象[]CurrentData{get{return}CurrentData;}set{if(_CurrentData==value)return;_CurrentData=value;RaiseChangeEvent(“CurrentData”);}
私有静态对象[]_先前的数据;
公共静态对象[]PreviousData{get{return}PreviousData;}set{if(PreviousData==value)return;PreviousData=value;RaiseChangeEvent(“PreviousData”);}
}

您链接到的文章有点混乱,我怀疑您混淆了这两种方法。看看作者的dropbox项目,似乎有两种方法——一种实现INotifyPropertyChanged的类,另一种不实现(Repository.cs)。后者使用我认为您正在尝试使用的StaticPropertyChanged事件方法。我想您只需要更改代码,使其不实现INotifyPropertyChanged,但请检查作者的dropbox代码以确定是否正确。

谢谢!删除InotifyProperty更改解决了所有问题…我太投入了,以至于错过了最基本的细节。。。