I must be missing something obvious here. Given the class below:
public class ContractForRefinance
{
public int ContrID { get; set; }
public string ContrNumber { get; set; }
public string LoanClass { get; set; }
public DateTime LoanDate { get; set; }
public decimal Balance { get; set; }
}
I'm trying to set up a multi-column listbox with headers like this:
ListViewDetailColumn contrIDColumn = new ListViewDetailColumn("ContrID");
contrIDColumn.Width = 150;
contrIDColumn.HeaderText = "ContrID";
lstContractForRefinance.Columns.Add(contrIDColumn);
ListViewDetailColumn contrNumberColumn = new ListViewDetailColumn("ContrNumber");
contrNumberColumn.HeaderText = "ContrNumber";
contrNumberColumn.Width = 100;
lstContractForRefinance.Columns.Add(contrNumberColumn);
ListViewDetailColumn loanClassColumn = new ListViewDetailColumn("LoanClass");
loanClassColumn.HeaderText = "Description";
loanClassColumn.Width = 100;
lstContractForRefinance.Columns.Add(loanClassColumn);
ListViewDetailColumn loanDateColumn = new ListViewDetailColumn("LoanDate");
loanDateColumn.HeaderText = "LoanDate";
loanDateColumn.Width = 100;
lstContractForRefinance.Columns.Add(loanDateColumn);
ListViewDetailColumn balanceColumn = new ListViewDetailColumn("Balance");
balanceColumn.HeaderText = "Balance";
balanceColumn.Width = 100;
lstContractForRefinance.Columns.Add(balanceColumn);
lstContractForRefinance.ShowColumnHeaders = true;
lstContractForRefinance.ShowCheckBoxes = true;
foreach (var item in applicationManager.ContractForRefinanceList)
{
lstContractForRefinance.Items.Add(item);
}
However, the control looks like this:
What am I missing?
Thanks
Carl