title: Databinding and Retrieving Values
body: <p>I'm currently binding a Company object to a DataGrid that is populated by an OleDB query. Each company has a unique ID, however I do not want to display the Company's IDs in the DataGrid.</p>
  
  <p>I can easily retrieve each Company's Name, which is displayed in the DataGrid, doing something simple such as getting the contents of the selected rows first cell. </p>
  
  <p>However, because the unique ID is not displayed I cannot retrieve the associated Company's ID. Essentially what I would like to achieve is something along the lines of;</p>
  
  <p><code>MySqlCommand sqlCmd = new MySqlCommand("UPDATE companies SET name = @name, addr1 = @addr1 WHERE CompanyID = @companyID)", sqlCon);</code></p>
  
  <p><code>name</code> and <code>addr1</code> are derived from textboxes that are bound in XAML after a user has selected a company in the DataGrid and clicked an <code>update</code> button. The textboxes are bound by;</p>
  
  <pre><code>&lt;TextBox Text="{Binding SelectedItem.CompanyName, ElementName=dataGrid}" TextWrapping="Wrap" Margin="10" IsReadOnly="true"/&gt;
  &lt;TextBox Text="{Binding SelectedItem.CompanyAddr1, ElementName=dataGrid}" Margin="10,0,10,10" Height="26" IsReadOnly="true"/&gt;
  </code></pre>
  
  <p>I could bind the ID to a TextBox and hide it, however I feel like there is a <em>better</em> way.</p>