I\'m working in wpf application i made a checkbox in the XAML, then my code calls a function in a class and in this function there is an if condition where its checking on w
Don't make the checkbox visible to the outside, just pass the current state of the checkbox to the function or class. Also consider binding the checkbox value to a class in the DataContext, directly accessing controls can be avoided most of the time in WPF, see also the MVVM pattern.