Example #1
1
        /// <summary>
        /// Updates the is-checked state of the check box, and updates the source
        /// of the binding so that changes are reflected in the view model.
        /// </summary>
        private void UpdateIsChecked(CheckBox checkBox, bool isChecked)
        {
            BindingExpression bindingExpression;

            checkBox.IsChecked = isChecked;
            bindingExpression = checkBox.GetBindingExpression(ToggleButton.IsCheckedProperty);

            if ((object)bindingExpression != null)
                bindingExpression.UpdateSource();
        }