title: Setting value of datagridtextcolumn cell WPF application
body: <p>Good day</p>
  
  <p>I must be missing something really simple here; I have a datagrid with two combobox columns and a datagridtextcolumn. Once the user has selected a value for both of these comboboxes (a value ranging from 1 to 5), a calculation is done with these 2 values (on a combobox selection changed event). I need to write the result of the calculation in to a cell (the datagridtextcolumn) and change the background of that cell to a specific colour based on the value. I have managed to find the values in the comboboxes and the index of the current row, but accessing the relevant cell to write the result to is getting the better of me...</p>
  
  <p>Here is the coding for the event handler that calls the calculation thus far:</p>
  
  <pre><code>private void cmbConseq_SelectionChanged(object sender, SelectionChangedEventArgs e)
  {
      var cellInfos = dgDeviation.SelectedCells;
      if (cellInfos == null)
      {
          return;
      }
      var content = cellInfos[0].Column.GetCellContent(cellInfos[0].Item);
      DataRowView row = (DataRowView)content.DataContext;//get the datacontext from FrameworkElement and typecast to DataRowView
      object[] obj = row.Row.ItemArray;//ItemArray returns an object array with single element
      int likely = Convert.ToInt16(obj[0]);
      int cons = Convert.ToInt16(obj[1]);
      int riskValue = new Calculations().riskRankingCalc(likely, cons);
  
      int rowIndex = dgDeviation.Items.IndexOf(dgDeviation.CurrentItem);
  </code></pre>
  
  <p>How do I write the 'riskValue' variable to the relevant cell in the currently selected row in the eventhandler?</p>