Using checkbox inside a Radspreadsheet in WPF

0 Answers 57 Views
GridView Spreadsheet
Cheruiyot
Top achievements
Rank 1
Cheruiyot asked on 27 Mar 2023, 01:23 PM
Hello, I am using Radspreadsheet for WPF. I need once I import data, I attach checkbox at the last column in each row.
This is what I have done so far:

            
    int rowCount = importxls.ActiveWorksheet.UsedCellRange.RowCount;
                int lastcolumn = importxls.ActiveWorksheet.UsedCellRange.ColumnCount;

                MessageBoxResult result = MessageBox.Show(rowCount.ToString());

                // Create a new checkbox and set its properties
                CheckBox checkbox = new CheckBox();
                checkbox.IsChecked = true;
                checkbox.VerticalAlignment = VerticalAlignment.Center;
                checkbox.Margin = new Thickness(5, 0, 0, 0);

                DependencyProperty chkBox = DependencyProperty.Register(
                      "Select", typeof(bool), typeof(CheckBox),
                      new UIPropertyMetadata(checkbox.IsChecked));

                for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
                {
                    
                    // Add the checkbox to the current row
                    RowSelection rowSelection = importxls.ActiveWorksheet.Rows[rowIndex];
                    CellIndex cellIndex = new CellIndex(rowIndex, lastcolumn);
                    CellSelection cellSelection = rowSelection.Worksheet.Cells[cellIndex];

                    cellSelection.SetValue(DateTime.Now); //checkbox should be here

                }


Where am I supposed to modify?
Anna
Telerik team
commented on 28 Mar 2023, 10:48 AM

Hi,

I've already responded to your ticket on another channel, and I am going to paste the same response here, for visibility and in case anyone finds the idea useful.

This particular scenario requires very serious customization and, while it seems it is possible to achieve, it requires quite a bit of additional code to be written. I've prepared a sample application which implements what you've described. I've attached it in a zip file, you should just add the proper references for it to run. Please, keep in mind it is only a rough draft designed to get you started and it has not been thoroughly tested.

Let me know if you have additional questions.

No answers yet. Maybe you can help?

Tags
GridView Spreadsheet
Asked by
Cheruiyot
Top achievements
Rank 1
Share this question
or