私は苦労しているデータバインディングに関する質問があります。WPFデータの文字列へのバインド
I持って私のxaml.csファイルで次のプロパティ:
private string _stationIdInstruction;
public event PropertyChangedEventHandler PropertyChanged;
public string StationIdInstruction
{
get { return _stationIdInstruction; }
set
{
_stationIdInstruction = value;
OnPropertyChanged("StationIdInstruction");
}
}
protected void OnPropertyChanged(string name)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
それはそのテキストとして文字列プロパティをピックアップし、私が更新するときTextBlock.Textを更新して、私はStationIdInstructionsへのTextBlockをバインドするにはどうすればよいですStationIdInstructions。
何か助けていただければ幸いです。
ソースコードに小さなエラーがあります。オープン「{」(「if(PropertyChanged!= null)」の後に忘れたか、存在しないif-blockを閉じるかのいずれかです)。 – vstrien