I have a DataGridView associated with a list. The values ββare displayed perfectly, when I click on a value, it starts editing, however, when I press Enter, the change is ignored, the data does not change. When I set a breakpoint in a set of values, I see that it is executed after editing, but no changed data is ever displayed. My binding code is as follows:
namespace DataGridViewList { public partial class Form1 : Form { public struct LocationEdit { public string Key { get; set; } private string _value; public string Value { get { return _value; } set { _value = value; } } }; public Form1() { InitializeComponent(); BindingList<LocationEdit> list = new BindingList<LocationEdit>(); list.Add(new LocationEdit { Key = "0", Value = "Home" }); list.Add(new LocationEdit { Key = "1", Value = "Work" }); dataGridView1.DataSource = list; } } }
The project is a basic Windows Forms project with a DataGrid created in the designer, with columns called "Key and Value" and setting DataPropertyName for Key / Value, respectively. There are no read-only values.
Is there any step that I am missing? Do I need to implement INotifyPropertyChanged or something else?
source share