Hi,
I would like to bind the "Font.Strikeout" property on one control based on the value in another control. For example, I have a column called "Setup Time" that I display in a form using an UltraNumericEditor control. I want the Setup Time control to have the strikeout applied when the value in another column called "Production Reported" is set to Yes. The following is the code I am trying to use but it is not working. Can you help me figure out the best way to do this?
if (fieldName == Constants.WorkOrderSetupTimeFieldName)
aControl.DataBindings.Add(new System.Windows.Forms.Binding("Font.Strikeout",_dataSource, Constants.WorkOrderIsProductionReportedFieldName, true, DataSourceUpdateMode.OnValidation));
With this particular code I get an arugment exception error saying that I cannot bind to the Strikeout property on the Setup Time control ...
Steve
Like the error says that is not a bindable property. What you should do is handle the ValueChanged event for the "Production Reported" control, and set the UltraNumericEditor.Appearance.FontData.Strikeout property to True on the "Setup Time" control in that handler.
Hi Brian ... Thank you for the response. I don't seem to have the ValueChanged event for the controls I'm using in my winform. I have events like Validated and Validating but I'm not sure that those would work in this case as I need for the Setup Time field to have the Strikeout applied without the user necessarily entering/exiting any of the controls. I'm also not sure that ValueChanged would work in this case as the "Production Reported" field is set when the application comes up and it cannot be changed by the user. The only time it could change is when the user refreshes the data in the application. Is there another event I can use so that I can apply the strikeout? We are currenlty using version 7.3 of the Infragistics toolset.
Thank you!
Forgive me if I misunderstood...I thought you wanted to strike out the text on one control when the value of another (UltraNumericEditor) control changes. After re-reading I see that you want to "...have the strikeout applied when the value in another column called "Production Reported" is set to Yes."
If by this you mean that you want to strikeout the text in the control when the value in a grid cell changes, you should use the grid's CellChange event instead. Note that at the time the event fires, the e.Cell.Value property does not reflect changes made during the edit mode session, so you would have to get the editor from the e.Cell.EditorResolved property, check its IsValid property, and if it returns true, get the current value from the e.Cell.EditorResolved.Value property.
Hi Brian ... I'm sorry, but it was my mistake. I was able to use the ValueChanged event to do exactly what I wanted. Sorry to have made you go through the extra exercise of thinking up another solution. What I did was use the ValueChanged event on the Setup Time numeric control so that when I set it programmatically it could apply the strikeout to itself if it detected the prdouction had been reported. Thanks again for all your help!!