Hi,
We recently had an issue reported about on of our apps running under citrix. The symptom was that if the app was minimised then maximised then the ribbon was blank. Only happened on one screen. We traced the problem to the listobject's IDataErrorInfo.Error setting a property on the underlying entity, causing validation to fire, rinse and repeat. After fixing this though, I noticed the method was still being called very frequently, particularly when the mouse moved over the grid, triggering a repaint which eventually called the Error method. Is this intentional behaviour, and if so why? Is there any property I can set to manually control when validation takes place
Thanks,
Kevin
Hi Kevin,
I'm a little confused about the relationship between the Ribbon and IDataErrorInfo. Ribbon has no support for DataBinding or IDataErrorInfo that I am aware of. So I assume you are talking about WinGrid here?
In any case, the grid is going to need to call into the IDataErrorInfo interface any time the row or cell paints and that includes when the mouse moves over a cell or row. So you need to make your IDataErrorInfo interface as efficient as possible. If you are re-validating the data every time this interface is called, then that will be very inefficient. You should cache the validation results and only re-validate when the data changes.
No, I meant the ribbon. App has a ribbon, childform has the grid. under citrix the ribbon wasn't repainting, as a result of the constant validating (due to our bug). I see why you might need to revalidate the listobject if you repaint the cell, if the grid doesn't cache the last result, and I can see can see in some circumstances that might be desirable. What killed it for us though was that Error was being called to revalidate the whole object rather than Item to revalidate the field who's cell was being redrawn. Individual field validation was lightweight, but we had an unavoidably expensive extra bit of validation in the Error implementation.
Off the top of my head, I would think that when you move the mouse over a grid cell, the grid only needs to repaint that one cell, so it would only need the IDataErrorInfo for that one particular cell. In theory, the grid would only need the errors for row if you moused over the grid's RowSelectors, which is where it shows the error icon.
But if that's the behavior you are getting, then I am clearly wrong. There must be some reason why the grid has to invalidate the entire row. It might have nothing specifically to do with the IDataErrorInfo, it could be some completely unrelated feature of the grid. For example, if you have set up your grid to do HotTracking of the rows this would mean the grid would have to invalidate and repaint the whole row when the mouse moved over it and this would mean getting the IDataErrorInfo whether it changed or not.
Is there anything else we can help you with?