dataBind 更改时更新标签

Update Label when dataBind changes

我需要从后面的代码中设置 UpdateSourceTrigger、PropertyChanged,但目前我还没有找到任何方法。

我正在尝试使用以下代码:

 factory.SetBinding(ContentProperty, new UpdateSourceTrigger("PropertyChanged"));

还有我的模特

public class Event : INotifyPropertyChanged
{
    public string Name { get; set; }

    public byte Song { get; set; }

    public byte _currentSong;

    public byte CurrentSong
    {

        get { return _currentSong; }

        set
        {
            _currentSong = value;
            NotifyPropertyChanged();
        }
    }

    public GroupType Group { get; set; }

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
    {
        var handler = PropertyChanged;
        if (handler != null)
            handler(this, new PropertyChangedEventArgs(propertyName));
    }

}

但是我有以下错误

Does not containt a constructor that takes 1 argument.

错误很明显,但我不知道(也没有找到太多信息)我该怎么做。

SetBinding 方法接受具有 UpdateSourceTrigger 属性:

Binding 对象
factory.SetBinding(ContentProperty, new Binding("CurrentSong") { UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged });