title: How to bind WPF DataGrid to ObservableCollection
body: <p>Can you give me a tip how to bind a WPF DataGrid to ObservableCollection. I had seen some posts and didn't find a direct answer. There and everywhere intricate problems are described but my problem rather is not sophisticated. I have an observable collection and WPF DataGrid. Both of them are in WPF application which is a client of a duplex contract WCF service.
  Here is an ObservableCollection:</p>
  
  <pre><code>private ObservableCollection&lt;MyClass&gt; _myCollection = new ObservableCollection&lt;MyClass&gt;();
  public ObservableCollection&lt;MyClass&gt; DownloadsCollection
  {
      get { return this._downloadsCollection; }
  }
  </code></pre>
  
  <p>Here is a XAML markup with DataGrid:</p>
  
  <pre><code>&lt;Window x:Class="DownloadManager_Client.MainWindow"
  . . . . . . . .&gt;
  
      &lt;DataGrid Name="dgDownloadsInfo" Grid.Row="2" Grid.Column="0" AutoGenerateColumns="False" CanUserAddRows="False"
                CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeColumns="False"
                CanUserResizeRows="False" CanUserSortColumns="False" SelectionMode="Single" SelectionChanged="dgDownloadsInfo_SelectionChanged"&gt;
            &lt;DataGrid.Columns&gt;
                  &lt;DataGridTextColumn Header="DownloadId" Visibility="Hidden"/&gt;
                  &lt;DataGridTextColumn Header="Target URL" FontFamily="Arial" /&gt;
                  &lt;DataGridTextColumn Header="Content Size" FontFamily="Arial"/&gt;
                  &lt;DataGridTextColumn Header="Path to Save" FontFamily="Arial"/&gt;
                  &lt;DataGridTextColumn Header="Bytes Downloaded" FontFamily="Arial"/&gt;
                  &lt;DataGridTextColumn Header="Percent (%)" FontFamily="Arial"/&gt;
                  &lt;DataGridTextColumn Header="Status" FontFamily="Arial"/&gt;
            &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
  . . . . . . . .
  &lt;/Window&gt;
  </code></pre>
  
  <p>And here is myClass class. It implemented in WCF service. Client receives instances of MyClass in callbacks from WCF service with duplex contract. After each instance of MyClass has been received then it is put in the ObservableCollection to substitute previous one with the same unique identifier.</p>
  
  <pre><code>[DataContract]
  public class MyClass
  {
      #region Properties
  
      /// &lt;summary&gt;
      /// Downloading unique ID.
      /// &lt;/summary&gt;
      [DataMember]
      public Guid UniqueId { get; set; }
      /// &lt;summary&gt;
      /// Target URL.
      /// &lt;/summary&gt;
      [DataMember]
      public String TargetUrl { get; set; }
      /// &lt;summary&gt;
      /// Path to Save.
      /// &lt;/summary&gt;
      [DataMember]
      public String PathToSave { get; set; }
      /// &lt;summary&gt;
      /// Percentage.
      /// &lt;/summary&gt;
      [DataMember]
      public Int32 Percentage { get; set; }
      /// &lt;summary&gt;
      /// Downloaded bytes number.
      /// &lt;/summary&gt;
      [DataMember]
      public Int64 DownloadedBytesQuantity { get; set; }
      /// &lt;summary&gt;
      /// Content size.
      /// &lt;/summary&gt;
      [DataMember]
      public Int64 RealContentLength { get; set; }
      /// &lt;summary&gt;
      /// Downloading status.
      /// &lt;/summary&gt;
      [DataMember]
      public String Status { get; set; }
  
      #endregion
  }
  </code></pre>
  
  <p>How can I bind DataGrid to ObservableCollection in my example? Give a hint on this topic. I bag your pardon for my poor English.</p>