저는 C# compact 프레임 워크에서 데이터 바인딩을 사용하고 있습니다. 나는 Textbox와 Label이있는 간단한 폼을 개발한다. Textbox (bindModelTextBox)에 바인드 된 데이터를 변경하고 동일한 데이터에 바인드 된 Label (bindModelLabel)에 의해 이러한 변경 사항을 표시하려고합니다. 여기에 코드입니다 :C# DataBinding이 업데이트되지 않습니다. 컨트롤
public partial class CreateShipment : Form {
//simple bean. Just one property: id, a string
private BasicShipmentBean toBindBasicShipment = null;
public CreateShipment() {
InitializeComponent();
BindingSource bsProva = new BindingSource();
toBindBasicShipment = new BasicShipmentBean();
toBindBasicShipment.id = "boo";
bsProva.Add(toBindBasicShipment);
bindModelLabel.DataBindings.Add("Text", bsProva, "id", true, DataSourceUpdateMode.OnPropertyChanged);
bindModelTextBox.DataBindings.Add("Text", bsProva, "id", true, DataSourceUpdateMode.OnPropertyChanged);
bindModelTextBox.LostFocus += textLoseFocus;
}
...
private void textLoseFocus(object sender, System.EventArgs e)
{
System.Diagnostics.Debug.WriteLine("focus lost. "+toBindBasicShipment.id);
}
때 텍스트 상자 느슨한 초점 I 데이터 레이블은 여전히 빈의 원래 id 값을 보여줍니다 빈으로 업데이트되지만 볼 수 있습니다. 내가 뭘 놓치고 있니?
혹시이 기능을 사용하셨습니까? 나는 동일한 문제를 가지고있다 - 그리고 나는 INotifyPropertyChanged – uTILLIty
아를 구현했다. CF3.9는 바인딩 될 객체에 의해 직접 명명 된 INotifyPropertyChanged를 필요로한다 - 그것은 기본 클래스에서 인터페이스를 검색하지 않을 것이다. 오 ~ .... – uTILLIty