Grid Columns

D

David McCallum

Given the code below, what changes are needed to show only the current and
name fields on the grid, also to show the Boolean field as a checkbox.

TIA

David McCallum

class Person{
public int ID { get; set; }
public string Name { get; set; }
public DateTime DateOfBirth { get; set; }
public bool Current { get; set; }
}

public MyForm()
{
InitializeComponent();
List<Person> sessions=new List<Person>
{
new Person()
{
ID = 1,
Name = "person",
DateOfBirth =
DateTime.Now,
Current = true
}
};

}
 
T

TWischmeier

You might want to take a look at the property DataGrid.TableStyles as
well as the classes DataGridTableStyle and DataGridColumnStyle. You
use the latter to detemine which columns are visible.

To display a checkbox column, you have to create your own
DataGridColumnStyle which draws a checkbox. I am currently working at
this, so if you remind me again in a couple of days I can give you my
solution for this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top