How to set Checkbox value from code?

B M-A 361 Reputation points
2023-02-16T14:34:06.2466667+00:00

Hello,

I want to set checkbox value from the code (WPF) but without success.

My code is something like this:

public Main(bool GrupMember)
        {
            InitializeComponent();
            bool idGrup =  true ;
                 
            checkbox.IsChecked = idGrup ;
            MessageBox.Show(idGrup.ToString());
 }
Developer technologies | Windows Presentation Foundation
Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    2 deleted comments

    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.