Guest User

Untitled

a guest
Jan 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. public class RowData
  2. {
  3. public string Box1 { get; set; }
  4. public string Box2 { get; set; }
  5. public string Box3 { get; set; }
  6. };
  7.  
  8. private ObservableCollection<RowData> Data = new ObservableCollection<RowData>();
  9.  
  10. ...
  11.  
  12. MyListView.ItemsSource = Data;
  13.  
  14. MyGridViewColumn.DisplayMemberBinding = new Binding("Box1"));
  15.  
  16. private void ListViewItem_DoubleClick(object sender, MouseButtonEventArgs e)
  17. {
  18. ListViewItem item = sender as ListViewItem;
  19. RowData data = item.DataContext as RowData;
  20. data.Box1 = "new string";
  21. }
  22.  
  23. public class RowData : INotifyPropertyChanged
  24. {
  25. private string box1;
  26. public string Box1
  27. {
  28. get { return box1; }
  29. set
  30. {
  31. if(box1 == value) return;
  32. box1= value;
  33. NotifyPropertyChanged("Box1 ");
  34. }
  35. }
  36. //repet the same to Box2 and Box3
  37.  
  38. public event PropertyChangedEventHandler PropertyChanged;
  39.  
  40. private void NotifyPropertyChanged(String propertyName)
  41. {
  42. if (PropertyChanged != null)
  43. {
  44. PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  45. }
  46. }
  47. }
Add Comment
Please, Sign In to add comment