Good day all.
I need to do something, but I have the feeling it is not possible...
We have a grid with processes. I need to change the state (defined in a code list), but the processes don't all have the same possible states.
Process A can change to state reject or complete
Process B can change to state Rework, blank, in progress and complete.
Can I change this code
<igEditors:ComboBoxItemsProvider x:Key="cbFKState" ItemsSource="{Binding Source={StaticResource odpHotworkS_State}}" DisplayMemberPath="State" ValuePath="IdState"> </igEditors:ComboBoxItemsProvider>
to enable it to use a different ItemSource, depending on the activeRecord?
Regards
Christo
Hello Christo,
You can do that. The CellValuePresenter exposes an Editor property which will return an instance of the editor in that cell. You can cast that to a XamComboEditor and then change its ItemsSource property accordingly.
You may also find helpful our methods Infragistics.Windows.Utilities.Get(Ancestor/Descendant)From(Type/Name) to go up/down the element tree and search for elements.
Hi Alex.
Like always, a quick and accurate reply. I was able to implement it as you instructed. I'm just adding the function to complete the thread. Thank you again for your help!
private void xamDataGridHotwork_Progress_CellActivated(object sender, Infragistics.Windows.DataPresenter.Events.CellActivatedEventArgs e) { if (e.Cell.Field.Label.ToString() == "State") { Cell activeCell = e.Cell; XamComboEditor myComboEditor = (XamComboEditor)CellValuePresenter.FromCell(activeCell).Editor; ComboBoxItemsProvider myCBitemsProvider = new ComboBoxItemsProvider(); ObjectDataProvider odb = (ObjectDataProvider)(this.Resources["odpHotwork_StateChanges"]); odb.MethodName = "GetStateChanges"; odb.MethodParameters.Clear(); odb.MethodParameters.Add(_idFlow); odb.Refresh(); HotworkDAL.Hotwork_StateChangesDataTable dt_state = (HotworkDAL.Hotwork_StateChangesDataTable)odb.Data; foreach (HotworkDAL.Hotwork_StateChangesRow row in dt_state) myCBitemsProvider.Items.Add(row); myCBitemsProvider.DisplayMemberPath = "State"; myCBitemsProvider.ValuePath = "IdFlow"; myComboEditor.DropDownClosed += new EventHandler<RoutedEventArgs>(myComboEditor_DropDownClosed); myComboEditor.ItemsProvider = myCBitemsProvider; } }