How to break out of a loop depending on a CheckBox Checked value while the loop is running?

Posted by Rayner Vaz on Stack Overflow See other posts from Stack Overflow or by Rayner Vaz
Published on 2011-11-14T16:54:52Z Indexed on 2011/11/14 17:51 UTC
Read the original article Hit count: 152

Lets say I want to call a function repeatedly if the user selects a CheckBox named "repeat" but the calls to the function should stop as soon as the user 'unchecks' the CheckBox.

I tried using the 'Checked', 'Click' and 'Tap' event of the CheckBox but once the loop starts, it does not sense any changes in the checkbox's state.

I even tried using a loop inside another button's _Click method, but then that creates a lock on the Button's 'pressed' state.

Any ideas/alternate suggestions?

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about windows-phone-7