title: Change Datagrid cell number of decimals
body: <p>I have a datagriId bound to an observable collection. I want to store the correct values in the observable collection (with all decimals) but I want to see less decimals in the datagrid.
  So I tried this
  <a href="https://stackoverflow.com/questions/12164079/change-datagrid-cell-value-programmatically-in-wpf">Change DataGrid cell value programmatically in WPF</a>
  and some similar others.</p>
  
  <p>In the end what I need is to change the value of the datagrid when the event is fired.</p>
  
  <pre><code>private void Datagrid_LoadingRow(object sender, DataGridRowEventArgs e)
  {
    DataGridRow row = e.Row;
    var pePCDmise = row.Item as PcDmisData.Measures;
  
    DataGridRow rowContainer = dtgResults.GetRow(0);
    DataGridCell  d = dtgResults.GetCell(rowContainer, 3);
  }
  </code></pre>
  
  <p>So the rowcontainer above is not null but when I try to get the cell value I get a null exception.
  Particularly:</p>
  
  <pre><code>public static DataGridCell GetCell(this DataGrid grid, DataGridRow row, int column)
  {
    if (row != null)
    {
      DataGridCellsPresenter presenter = GetVisualChild&lt;DataGridCellsPresenter&gt;(row);
  
      if(presenter == null)
      {
        grid.ScrollIntoView(row, grid.Columns[column]);
        presenter = GetVisualChild&lt;DataGridCellsPresenter&gt;(row);
      }
  
      DataGridCell cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
      return cell;
    }
    return null;
  }
  </code></pre>
  
  <p>the presenter above is null and it's null also after having entered the if.</p>
  
  <p>How can I make it work?
  Thanx</p>
  
  <p>---ADD----
  Aside from the aforementioned problem how can I make a one-way-bind? I have set the datagrid bind with </p>
  
  <pre><code> dtgResults.ItemsSource = easyRunData.olstMeasures;
  </code></pre>
  
  <p>but now I want to change the dtgResults number of decimals only and not the observable collection value.</p>