title: Null To Boolean IValueConverter not working
body: <p>How do I use an IValueConverter to convert nulls into booleans?</p>
  
  <p>I'm using wpf to try to display a bunch of boolean values (in checkboxes). When a new record is created, these values are null, and appear as 'indeterminate' in the checkboxes. I want the nulls to appear and save as 'false' values.  </p>
  
  <p>I tried to create a NullToBoolean converter that takes null values from the database and displays them as false, <strong>and then</strong> saves them as false when the user hits save.  (Essentially, I'm trying to avoid the user having to click twice in the checkboxes (once to make it true, then again to make it false).  This seems to work on import - ie null values are shown as false - but unless I do the two-click dance the value doesn't change in the database when I save.</p>
  
  <p>My Converter:</p>
  
  <pre><code>[ValueConversion(typeof(bool), typeof(bool))]
  public class NullBooleanConverter : IValueConverter
  {
  
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
      if (value != null)
      {
        return value;
      }
      return false;
    }
  
    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
      if (value != null)
      {
        return value;
      }
      return null;
    }
  }
  </code></pre>
  
  <p>One of the checkboxes I'm trying to have the Converter work with:</p>
  
  <pre><code>    &lt;CheckBox Grid.Column="1" Grid.Row="0" Padding="5" Margin="5" VerticalAlignment="Center" Name="chkVarianceDescriptionProvided" IsThreeState="False"&gt;
        &lt;CheckBox.IsChecked&gt;
          &lt;Binding Path="VarianceDescriptionProvided" Mode="TwoWay"&gt;
            &lt;Binding.Converter&gt;
              &lt;utils:NullBooleanConverter /&gt;
            &lt;/Binding.Converter&gt;
          &lt;/Binding&gt;
        &lt;/CheckBox.IsChecked&gt;
      &lt;/CheckBox&gt;
  </code></pre>
  
  <p>I don't know if the problem is because my code is wrong, or if it's a case of the Converter thinking that nothing has changed, therefore it doesn't need to <code>ConvertBack</code>.  I have tried all the <code>Mode</code>s and switched code in Convert with ConvertBack, but nothing seems to work.</p>
  
  <p>Can someone point out what I need to do to fix this?</p>