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
70
Moving ValueLists with Rows
posted

Hi Everyone,

I have an UltraGrid with two bands; the first band contains non-editable parent rows, and the second band has an editable column that may have both ordinary and combobox cells. The value list for each combobox cell is different from others, and it depends on the parent row properties. The UltraGrid is bound to a BindingList, and the value lists, where needed, are instantiated as UltraDropDowns that are bound to a BindingList property of the row's ListObject. The displayed properties implement INotifyPropertyChanged interface to notify the grid of changes.

The code follows:

RDSViewParameter parameter = propertyRow.ListObject as RDSViewParameter;
if (parameter.ValueList != null)
{
UltraDropDown dropDown = new UltraDropDown();
dropDown.SetDataBinding(parameter.ValueList, null);
propertyRow.Cells[1].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
propertyRow.Cells[1].ValueList = dropDown;
dropDown.DropDownWidth = 0;
dropDown.DisplayLayout.AutoFitStyle = AutoFitStyle.ExtendLastColumn;
dropDown.DisplayLayout.Bands[0].ColHeadersVisible = false;
}

Everything appears to work fine, until I want to reorder the parent rows (first band) through reordering of the bound BindingList. The child rows move with parent rows as expected, but the ValueLists don't! As a result, the moved child row cells often have incorrect styles (Default vs DropDownLists) and incorrect value lists. I tried manually updating value lists (without binding them), but I god all sorts of errors. After searching those errors, I found out that I should not tamper with an UltraGrid that is bound to a DataSource, and figured this is not a good practice. My question is how I can correctly move value lists with cells as their parent rows are reordered.

Any help would be appreciated.

Thanks.

Parents Reply Children
No Data