title: Trying To AutoUpdate My Datagrid by Refreshing the Dataset in My WPF Application
body: <p>I hope someone can help me as I am a real newbie.  I have a WPF Application that is bound to an SQL database on my webServer.  Information updating the database is done from an automated trading platform.  This application is being designed just to monitor the changes in real time.  Binding the data from the webserver to the datagrid was no problem.  However, I cannot for the life of me figure out how to make the datagrid update in realtime.  The closest I could do was add a refresh button which does successfully update the application everytime I click it.  However, I would like it to autoupdate on its own whenever the database has automated changes.  Can someone please show me how I can modify my code to make this work? I have placed my code below. Thanks!</p>
  
  <pre><code>using System.Windows;
  using Microsoft.Windows.Controls.Primitives;
  using System.Collections.Generic;
  using C1.WPF.DataGrid;
  using StylingWPFGrid.ForexDataSetTableAdapters;
  using System.Windows.Threading;
  using System;
  
  namespace StylingWPFGrid
  { 
  /// &lt;summary&gt;
  /// Interaction logic for Window1.xaml
  /// &lt;/summary&gt;
  public partial class WPFGrid : Window
  {
  
      private ForexDataSet _infoDataSet = null;
      public ForexDataSet infoDataSet
      {
          get
          {
              if (_infoDataSet == null)
              {
                  _infoDataSet = new ForexDataSet();
                  infoTableAdapter info = new infoTableAdapter();
                  info.Fill(_infoDataSet.info);
              }
  
              return _infoDataSet;
  
          }
      }
  
      private ForexDataSet _tradesDataSet = null;
      public ForexDataSet tradesDataSet
      {
          get
          {
              if (_tradesDataSet == null)
              {
                  _tradesDataSet = new ForexDataSet();
                  tradesTableAdapter trades = new tradesTableAdapter();
                  trades.Fill(_tradesDataSet.trades);
              }
              return _tradesDataSet;
          }
      }
      public WPFGrid()
      {
          InitializeComponent(); this.AccountsDataGrid.ItemsSource = infoDataSet.info;
          InitializeComponent(); this.TradesDataGrid.ItemsSource = tradesDataSet.trades;
  
      }
  
      private void QuitBtn_Click(object sender, RoutedEventArgs e)
      {
          this.Close();
      }
  
      private void RefreshBtn_Click(object sender, RoutedEventArgs e)
      {
          infoTableAdapter info = new infoTableAdapter();
          info.Fill(_infoDataSet.info);
  
      }
  
  }
  </code></pre>
  
  <p>}</p>