C#/SilverLight
ItemSource 로 데이터를 넣었을 때 수정시 데이터 반영을 하려면..
퓨어레드
2012. 6. 12. 15:56
ItemSource 로 데이터를 넣은 뒤.. ItemSource 안에 있는 내용을 수정하여 Control 에 적용하려면
ItemSource 로 들어가는 데이터에
INotifyPropertyChanged 를 구현해주면 된다.
샘플소스
public class UploadFileInfo : INotifyPropertyChanged
{
long recvFileSize = 0;
public long RecvFileSize
{
get { return recvFileSize; }
set
{
recvFileSize = value;
NotifyPropertyChanged ("RecvFileSize");
}
}
#region INotifyPropertyChanged Members
private void NotifyPropertyChanged (string prop)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
handler (this, new PropertyChangedEventArgs (prop));
}
public event PropertyChangedEventHandler PropertyChanged;
#endregion