title: Why changing DataGrid ComboBox value does not update the bound property at all?
body: <p>I have DataGridComboBoxColumn that is supposed to show integers or text "Default". When I add row the combobox gets correct value from viewmodel's bound property, but when I change value in user interface, the property's set is not called. I tried both SelectedValueBinding and SelectedItemBinding. Converter's ConvertBack is never called. I don't event know should it be called.</p>
  
  <p>Things that work:</p>
  
  <ul>
  <li>DataGrid SelectedItem binding</li>
  <li>Text column binding both ways (omitted here for shortness)</li>
  </ul>
  
  <p>Here is my code:</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;DataGrid Name="SelectionSetsGrid" CanUserAddRows="False" CanUserResizeColumns="True" CanUserSortColumns="True" 
                        ItemsSource="{Binding SelectionSets}" AutoGenerateColumns="False"
                        SelectedItem="{Binding SelectedSelectionSet}"&gt;
   &lt;DataGrid.Columns&gt;
    &lt;DataGridComboBoxColumn Header="Width" SelectedValueBinding="{Binding LineWidthIndex}"&gt;
      &lt;DataGridComboBoxColumn.ElementStyle&gt;
          &lt;Style TargetType="ComboBox" BasedOn="{StaticResource Theme.ComboBox.Style}"&gt;
              &lt;Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.LineWidths}"/&gt;
              &lt;Setter Property="IsReadOnly" Value="True"/&gt;
              &lt;Setter Property="ItemTemplate"&gt;
                  &lt;Setter.Value&gt;
                      &lt;DataTemplate&gt;
                          &lt;WrapPanel&gt;
                              &lt;TextBlock Text="{Binding Converter={StaticResource IntToIntTextOrDefaultConverter}}" VerticalAlignment="Center"/&gt;
                          &lt;/WrapPanel&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
          &lt;/Style&gt;
      &lt;/DataGridComboBoxColumn.ElementStyle&gt;
      &lt;DataGridComboBoxColumn.EditingElementStyle&gt;
          &lt;Style TargetType="ComboBox" BasedOn="{StaticResource Theme.ComboBox.Style}"&gt;
              &lt;Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.LineWidths}"/&gt;
              &lt;Setter Property="ItemTemplate"&gt;
                  &lt;Setter.Value&gt;
                      &lt;DataTemplate&gt;
                          &lt;WrapPanel&gt;
                              &lt;TextBlock Text="{Binding Converter={StaticResource IntToIntTextOrDefaultConverter}}" VerticalAlignment="Center"/&gt;
                          &lt;/WrapPanel&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
          &lt;/Style&gt;
      &lt;/DataGridComboBoxColumn.EditingElementStyle&gt;
    &lt;/DataGridComboBoxColumn&gt;
   &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>ViewModel (ViewModel implements INotifyPropertyChanged and SetValue raises PropertyChanged):</p>
  
  <pre><code>public class SelectedObjectsViewModel : ViewModel
  {
      private int[] _lineWidths = { -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
      public ObservableCollection&lt;int&gt; LineWidths { get; private set; };
  
      private ObservableCollection&lt;SelectionSetViewModel&gt; _selectionSets;
      public ObservableCollection&lt;SelectionSetViewModel&gt; SelectionSets
      {
          get { return _selectionSets; }
          set { this.SetValue(ref _selectionSets, value); }
      }
  
      private SelectionSetViewModel _selectedSelectionSet;
      public SelectionSetViewModel SelectedSelectionSet
      {
          get { return this._selectedSelectionSet; }
          set { this.SetValue(ref _selectedSelectionSet, value); }
      }
  }
  </code></pre>
  
  <p>ViewModel for DataGrid row (ViewModel implements INotifyPropertyChanged and SetValue raises PropertyChanged):</p>
  
  <pre><code>public class SelectionSetViewModel : ViewModel
  {
      public SelectionSetViewModel()
      {
          LineWidthIndex = -1;
      }
      private int _lineWidthIndex;
      public int LineWidthIndex
      {
          get { return _lineWidthIndex; }
          set { SetValue(ref _lineWidthIndex, value); }
      }
  </code></pre>
  
  <p>Converter:</p>
  
  <pre><code>public class IntToIntTextOrDefaultConverter : IValueConverter
  {
      public object Convert(object value, Type targetType, object parameter,
          System.Globalization.CultureInfo culture)
      {
          if ((int)value == -1)
              return Fusion.App.Current.Resources["StrDefault"].ToString();
  
          return value.ToString();
      }
  
      public object ConvertBack(object value, Type targetType, object parameter,
          System.Globalization.CultureInfo culture)
      {
          return value.Equals(true) ? parameter : Binding.DoNothing;
      }
  }
  </code></pre>