Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My original question obviously wasn't clear, sorry about that.</p> <p>The problem wasn't with databinding to a DataGridView in general, or with the implementation of a DataGridViewComboBoxColumn - as the people who have answered already rightly say, that is well documented on the web.</p> <p>The problem I've been trying to solve is with the refresh of properties that are drilling down through relationships.</p> <p>In my orders example, when I change the value of the "Product" column, the "Product Type" column is not being updated - even though in the code I am setting the property and firing the NotifyPropertyChanged event. (In debug I go to all the right places)</p> <p>After a lot of poking around I realised that this was not even working when I directly set the "Product Type" property of datasource, rather that setting it in the "Product" setter.</p> <p>The other thing that I believe has me back on the right track is that when I provide a mocked dataccess layer, created in the main form, everything works fine.</p> <p>Also, when I copy the IList made by nHibernate to a IBindingList - everything again appears fine.</p> <p><strong>So</strong> the problem is I think with threading and the NotifyPropertyChanged events being lost when using certain datasources, in certain ways (wish I could be more definitive than that!)</p> <p>I'm going to keep researching better ways of resolving this than copying the IList to the IBindingList - maybe I need to learn about thread marshalling. </p> <p><strong>Edit</strong></p> <p>I've now developed a solution that solves the issue and think I understand what was confusing me - basically it appears that anything but basic property databinding doesn't play nicely for lists that aren't derived from BindingList - as soon as I was trying to databind to properties that fired chained NotifyPropertyChanged events, things went haywire and I my events got lost.</p> <p>The data access solution I have now is using a variation of the Rob Conery <a href="http://blog.wekeroad.com/blog/crazy-talk-reducing-orm-friction/" rel="nofollow noreferrer">IRepository</a> pattern, returning my collections to be bound as a custom class I made, a SortableBindingLazyList that derives from BindingList, implements the Sort Core methods and also stores its internal list as a query, delaying the list materialisation.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload