Scenario:
There were XamDataGrid which user able to add purchasing details for their warehouse. When user purchase materials from different units like (Meters, Kilograms) however user only use Yard in their manufacturing process.
If user select Yard for their unit and they get those materials from Meters, then user need to set Meter to Yard conversion automatically and freeze the conversion cell.
How to implement:
Add value change event to the Unit columns
<EventSetter Event="igEditors:ValueEditor.ValueChanged" Handler="PUOM_OnValueChanged" />
<EventSetter Event="igEditors:ValueEditor.ValueChanged" Handler="SUOM_OnValueChanged" />Code-behind:
private void SUOM_OnValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e) { DataRecord dt = (DataRecord)xamGridLines.ActiveRecord; Cell cellConversion = dt.Cells["Conversion"] as Cell; var cellEditor = Infragistics.Windows.DataPresenter.CellValuePresenter.FromCell(cellConversion).Editor; cellEditor.IsReadOnly = true; }
If user need to inactive entire column use following code
snippet
private void SUOM_OnValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e) { xamGridLines.FieldLayouts[0].Fields["Conversion"].Settings.AllowEdit = false; xamGridLines.ActiveRecord.FieldLayout.Fields["Conversion"].Settings.AllowEdit = false; }
No comments:
Post a Comment