Note that there are some explanatory texts on larger screens.

plurals
  1. POedit multiple rows selected in a GridControl in TextEdits bound to the same bindingsource
    text
    copied!<p><strong>My setup:</strong> </p> <p>C#.Net 4.0, Windows Forms, DevExpress 13.1.5 although I doubt its a DX issue </p> <p>I have a form with a GridControl (with GridView) on the top and a detail area that holds TextEdits and other edits in a LayoutControl below. Both the grid and the edits below are bound to the properties of the objects contained in a list in the binding source. The grid is set to ReadOnly, MultiSelect, RowSelect and all its columns are set to ReadOnly, not focusable. Editing is only happening in the detail area below.</p> <p><strong>The behavior I want to create:</strong></p> <p>When multiple rows are selected in the grid the edits below should show the following:</p> <ul> <li>the value of field in question is the same in all selected rows -> show the value</li> <li>the value of the field in question differs between the rows -> show nothing</li> </ul> <p>if the user writes into the TextEdit while multiple rows are selected:</p> <ul> <li>the value of the edit should update the values of the same field of all the selected rows</li> </ul> <p><strong>Where I am with this:</strong></p> <p>I'm working on a solution by building a custom BindingSource that would be aware of the selection. It would bind the list of object to the grid and a single object that is not part of the list to the edits. Depending on the selection I would set the properties of that single object or forward its changes to the selected objects in the list.</p> <p>I got that working for a single property with 2 binding sources and would now extend it to use reflection to do this for all of the public properties. I also want to encapsulate the whole behavior into a class that looks and acts like BindingSource just with that added behavior.</p> <p><strong>The question:</strong></p> <p>Is there a simpler way to achieve this? Does something already exist which can do this that I overlooked in either .Net or DevExpress? Are there traps to my approach that I should consider or why I should go about this totally differently?</p>
 

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