我正在搜索某个事件触发时重新运行ValueConverter
的方法。 ValueConverter
计算TimeSpan
到Datetime
属性并将其格式化为x (minutes|hours) ago
。为了获得某种更新,我需要重新触发IValueConverter。这可以在不使用黑客攻击的情况下完成,例如将相同的DateTime值重新分配给属性吗?
这是Datamodell:
private static DataModell modell = null;
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string info) {
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
public DataModell() { }
public static DataModell Instance {
get {
if (modell == null) {
modell = new DataModell();
}
return modell;
}
}
private ObservableCollection<HistoryContent> _History = new ObservableCollection<HistoryContent>();
public ObservableCollection<HistoryContent> History {
get {
return _History;
}
}