私はINotifyPropertyChangedを実装し、SelectedTopicDescriptionプロパティを持ち、テキストプロパティTextプロパティをこのパブリックプロパティにバインドしようとしています。私はプロパティが変更されているが、テキストボックスが更新されていないことを知っている。SilverlightテキストボックスプロパティをUserControlのpublicプロパティにバインドする問題
私はいくつかのことを試しましたが、これは簡単であるはずです。
私はUserControl xaml内で以下のdatacontextを使用しようとしましたが、何の効果もありませんでした。私は依存性の適切性について読んだことがありますが、私はINotifyPropertyChangedを使ってこれを行うことはできませんか?
あなたのお手伝いがありがとうございます。
のDataContext = "{バインディングRelativeSource = {RelativeSource自己}}"
public partial class CodePage : UserControl ,INotifyPropertyChanged{
private string _selectedTopicDescription = string.Empty;
public string SelectedTopicDescription {
get { return _selectedTopicDescription; }
set {
_selectedTopicDescription = value;
OnPropertyChanged("SelectedTopicDescription");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string property) {
PropertyChangedEventHandler ph = this.PropertyChanged;
if (ph != null)
ph(this, new PropertyChangedEventArgs(property));
}
...
テキストボックスである.. 幅= "200" 証拠金= "141,142,0,153" テキスト= "{バインディングSelectedTopicDescription}" たHorizontalAlignment = "左">
コードで直接DataContextを割り当てようとしましたか? –