RadCheckedListBox data loading

1 Answer 69 Views
CheckedListBox
Carl
Top achievements
Rank 1
Iron
Iron
Iron
Carl asked on 08 Nov 2023, 03:03 PM

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

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Nov 2023, 02:15 PM

Hello, Carl,

Please have in mind that the ListViewDetailColumn is relevant for RadListView and its ListViewType.DetailsView. Additional information is available in the following help article: https://docs.telerik.com/devtools/winforms/controls/listview/populating-with-data/unbound-mode#adding-columns 

Since RadCheckedListBox is a derivative of RadListView, it is necessary to specify the ViewType to DetailsView in order to benefit the columns. You can also use the ListView >> Settings example as a tutorial how to setup the columns and show the checkboxes:

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
CheckedListBox
Asked by
Carl
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or