Jun 5, 2009 at 4:36 AM


This is the third time that I post the same problem (HASHTABLE issue, Force a refresh,Datagrid and Hashtable values).

Please can anyone help me on this?

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

I have no problem with witting "dataGrid1.ItemsSource = _hashtable.Values; " with Xceed DataGrid.

Why the following short code doesn't work?
How can I do the job? I mean, if I can't use the hashtable directly what can I use knowing the hashtable could refresh several time per second?


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; }