Doesn’t refresh datagrid in view

Jan 26, 2011 at 3:46 PM

H I use SQL CE and LINQ. I bind property typeof Table on ItemSource of Datagrid control from WPF Toolkit.

Something like this.

    public Table<TestNick>  MySource
        get { return _tab; }
            _tab = value;


    <Controls:DataGrid Name="Dg" 
                       ItemsSource="{Binding Path=MySource, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"

I retrieve data from DB with LINQ:

        const string connStr = @"Spiri_SQL_CE_DB.sdf";
_dc = new Spiri_SQL_CE_DB(connStr);

Then I insert some data in table, load this data to the property which is bind on ItemSource of DataGrid control.

     MySource = _dc.TestNick; // TestNick is name of the table

all data are showed in DataGridView. Then add new data to the db table, refresh property:

//add new data to table

//refresh property
MySource = _dc.TestNick;

But I don’t see new data in DataGridView. What is bad?

If I check the ItemSource property, it consit all old data + new data, but in view I see only old data:

var source = Dg.ItemsSource; // ItemSource consit old + new data 

Thank for help.