In my WPF app I have implemented LINQ to SQL query which populates an Observable Collection connected with ListView. It is in this method which I can call from somwhere and it works OK:
private void VisualizeAllShows()
{
MyfirstdbDataContext context = new MyfirstdbDataContext();
_ShowQuCollection.Clear();
var sh = from p in context.Shows select p;
foreach (var p in sh)
_ShowCollection.Add(new ShowsQu
{
Date = p.Date,
Time = p.Time,
Description = p.Description
});
}
Now I need this updating to take place automatically on database table data changing.
Should I use for this purpose this public event in my LINQ to SQL class:
public event PropertyChangedEventHandler PropertyChanged;
If so, please, how to use an event-handler which would fire from data changing? If no, where I should look for right way to do this?