Using a Checkbox

Posted by: Luis.Alvarez on 13 August 2018, 10:52 pm EST

    • Post Options:
    • Link

    Posted 13 August 2018, 10:52 pm EST

    My application requires the use of checkboxes within the spreadsheet to allow the user to select them. Based on the answers I’ve seen here I used a Style to show checkboxes in the Header Rows, my preference is to show them in cells outside the header rows. The checkboxes are displayed in the HeaderRows but I have not been able to programmatically access these CheckBoxes to set/clear the .IsChecked property or change the text content. Here’s what I used in the xaml file:

    <Window.Resources>





    <Setter.Value>











    </Setter.Value>





    </Window.Resources>

    Is there a way to programmatically access these CheckBoxes?

    Thank you,

    Luis

  • Posted 15 August 2018, 8:08 pm EST

    Hi Luis,

    Please refer to the attached sample which shows how you can bind the isChecked property of Checkbox.

    Thanks,

    Deepak SharmaSpreadCheckBoxBinding.zip

  • Posted 15 August 2018, 11:23 pm EST - Updated 29 September 2022, 6:10 am EST

    Deepak,

    Thanks for your response but what I’m looking for is a way to access the checkboxes that are shown in the spreadsheet row headers. In the partial xaml code that I included in my initial question I used a Style to display checkboxes in the row headers of the spreadsheet (see attached picture). As you can see checkboxes are shown but I can’t find a way to programmatically manipulate them individually . For instance I would like to hide the checkboxes in row 1, set or clear IsChecked for Row 0, disable the checkbox for row 2, add additional checkbox as needed based on user inputs, etc.

    Luis

  • Posted 22 August 2018, 11:31 pm EST

    Hello,

    I don’t find a direct way to do this in Spread. You would need to get through the VisualTreeHelper and get the control and then set it’s property as desired.

    Spread for WPF does not have support CellTypes where controls can be placed in cells and can be accessed.

    Thanks,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels