My simple customer class:
class Customer
{
[DisplayName("Customer Name")]
public string Name { get; private set; }
public Customer(string name)
{
Name = name;
}
}
And the binding logic on a Form control, which contains GridDataBound control:
public partial class Form1 : Form
{
private readonly List<Customer> _customers;
public Form1()
{
InitializeComponent();
_customers = new List<Customer>();
gridDataBoundGrid1.DataSource = _customers;
}
private void BtnAddCustomer(object sender, EventArgs e)
{
_customers.Add(new Customer("Customer 1"));
gridDataBoundGrid1.Refresh();
}
}
If I run my application the first column in the grid is named 'Name' instead of 'Customer Name'. Is DisplayName attribute supported?