Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
MDI app with independent Selected Row
posted

I've written an MDI app using grids. The grids bind to business objects that implement BindingList and ITypedList. The app works just fine except that I would like to know if there's a way to have the selected row be independent when two windows displaying the same backend data are open. For instance if I have Window1->Grid1->BusinessData and Window2->Grid2->BusinessData (i.e., two windows displaying the same set of data), when I click on a row on Grid1, the same row gets selected on Grid2. My intention is to be able to look at different records in the two windows even though it's the same backend data. I've looked through the .NET documentation on BindingList and nothing jumped out at me that would cause this behavior, but I might have missed something obvious. 

 Thanks in advance.

  • 469350
    Verified Answer
    Offline posted

    Hi,

        This is determined by the BindingContext. Typically, the BindingContext of a control is the form it's on. So I would think if your grids are on two different forms, they would not stay synchronized. Maybe both of your grids are bound to a data source that is on the main MDI form? If that's the case, then this is very easy to fix. All you have to do is set the BindingContext of the grid to the BindingContext of it's parent form. You would do this in the Form_Load or maybe right before or after you set the grid's DataSource.