Forum Discussion

dcfecker's avatar
dcfecker
Contributor
7 years ago
Solved

my WPF Desktop Application objects do not evaluate the IsChecked as true or false

I have a WPF Dekstop application that contains some control objects

These objects have the property "IsCheck" and evaluate as either "true" or "false"

I can return the object property booleans, and even convert ToString

But the "IF" statements always evaluate as "true" even when they are "false"

Looking at this property in the TestComplete "Object Browser" they all show the "IsChecked" property as being boolean

So why does the following always evaluate through the "True" path. Even when IsChecked is False?

 

if (controlSwapper.toolContainer.ContentPresenter3.SurfaceToggleButton.IsChecked) {

  do_something;

} else {

  set the IsChecked property to true;

  do_something _else;

}

2 Replies

    • dcfecker's avatar
      dcfecker
      Contributor

      Hah! It's always something simple! I was doing the opposite because I couldn't find this function. Convert to string and compare the string to "true" or "false". This is much better, thanks!