Datagrid and Hashtable values

Apr 11, 2009 at 1:43 AM

I want to see the values of my hashtable in a dataGrid when the hashtable is modified without implementing the INotifyPropertyChanged.

Why the following code doesn't work?
How can I do the job?


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace DataGridWPF
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
        private Hashtable _hashtable;

        public Window1()
            _hashtable = new Hashtable();
            dataGrid1.ItemsSource = _hashtable.Values;

        private void button1_Click(object sender, RoutedEventArgs e)
            Trade trade = new Trade();
            trade.Date = DateTime.Now;
            trade.Price = 20;

            _hashtable.Add(Guid.NewGuid(), trade);



    public class Trade
        public double Price { get; set; }
        public DateTime Date { get; set; }