c# - How to update a BindingSource based on a modified DataContext -


In my application, / P> Jobs = dbc.Jobs.ToDictionary (j = & gt; j.Id, j = & gt; j);

Then I am binding the dictionary with the binding source:

  bsJob.DataSource = jobManager.Jobs.Values.ToList ();  

I refresh the datacontext and dictionary regularly when new jobs are added to the database (whether directly running through a local application or on a different machine): < / P>

  dbc.Refresh (RefreshMode.OverwriteCurrentValues, dbc.Job); Jobs = dbc.Job.ToDictionary (J => J.D., J = & gt; J);  

How can I also update the binding source to accommodate changes?

I do not see the relation from the job class to the customer class, so I will assume that you type it Want to and not the job manager? Customer value. List ();

There are already some types of events triggering your refresh, because you have mentioned that you update "regular", then you basically have a binding source at that time. Datasource Assign a new value to the property.

  Dbc.Refresh (RefreshMode.OverwriteCurrentValues, dbc.Customer); Customer = dbc.Customer.ToDictionary (C => CID, C => C); BsJob.DataSource = jobManager.Jobs.Values.ToList (); // It was right to believe this statement  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -