title: WPF datagrid binding with custom columns
body: <p>Currently I am working on WPF application (with MVVM) in which I am displaying data in the <code>DataGridView</code>.</p>
  
  <pre><code>&lt;DataGrid RowHeaderWidth="0" ItemsSource="{Binding PartsList,UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Header="Item Name" IsReadOnly="True" Width="*" Binding="{Binding ProductName}"&gt;&lt;/DataGridTextColumn&gt;
          &lt;DataGridTextColumn Header="Model Name" IsReadOnly="True" Width="*" Binding="{Binding CarModelName}"&gt;&lt;/DataGridTextColumn&gt;
          &lt;DataGridTextColumn Header="Company Name" IsReadOnly="True" Width="*" Binding="{Binding CompanName}"&gt;&lt;/DataGridTextColumn&gt;
          &lt;DataGridTextColumn Header="Price" IsReadOnly="True" Width="*" Binding="{Binding Rate}"&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>Here PartsList is an <code>ObservableCollection</code> of entity Part.</p>
  
  <p>Now I want to add custom column to the <code>DataGrid</code> which shows discount and another column which shows net amount. How can I do this?</p>
  
  <p>Please give a good idea to do this as I need to work with thousands of records so performance is very important for me.</p>
  
  <p>Thank you in advance.</p>