Weird problem that looks straight forward but not sure what am I missing -
I am using a xamGrid bound to observable collection. The collection has data rows which I can see in the grid. Now I apply the Grid filter (by clicking on the icon on grid column) and eliminate few rows. Everything works fine till this point.
Now I have a button and on it click I am adding new row to the grid. However the moment I click on the button a row gets added to the underlying collection however since it does not "qualify" for current filter it never shows up on grid. Is this the limitation of the grid or am I missing something.
The worst thing is I have cell validation which appears on screen top + LEFT instead on the cell as the row itself is not been seen on grid.
Hi shaileng,
Not really sure I understand exactly what the issue is here. If there is a filter applied to the XamGrid and a row is added that does not match this filter, I would expect that the row would not be visible. It doesn't match the filter. Keeping the newly added row in view regardless of whether it matches the filter or not is currently not supported. As soon as the row is added, the filter is evaluated again and the row is kept/removed based on the result.
If you would like for the row to remain visible after it has been added, this would require a filtering system that did not re-evaluate everytime the data has updated. For this I recommend that you suggest a new product idea at http://ideas.infragistics.com. If you create a new idea for this, please include a link to this thread so product management will be able to look back at this case.
As for your cell validation, how exactly have you implemented this? Are you using the built in support for IDataErrorInfo and the validation error is appearing in the wrong spot? Or is this some kind of custom implementation?
Thanks for your help.
Actually the moment we add new row it does even show up and since it has NULL values it disappears. I was expecting the row to be available for data entry and if after data entry the value doesn't agree with applied filter then hiding it will make sense however here it doesn't give me even an opportunity to fill in the data
Yes IDataErrorInfo shows validation message at Top + Left of screen i.e., out of expected grid area all together
Rather than adding the row directly to the underlying collection you should use the add new row feature of the XamGrid. Since you are adding a row to the grid data source it is going to follow the rules I laid out above. To allow the user to type in the values that he wants for a newly added row, you should use the add new row feature.
http://help.infragistics.com/doc/WPF/2014.2/CLR4.0/?page=xamGrid_Add_New_Row.html
As for the IDataErrorInfo validation message, this seems like it would be a bug. I'm will build a sample to see if I can reproduce this.
When you add the row data object to your collection, are you just instantiating an empty object and adding that? I created a basic example of what I think you are doing but when I have a filter applied and I add a row via button click, I don't see any IDataErrorInfo errors appearing. The rows are definitely going through the validation process because I can stick a breakpoint in the IDataErrorInfo stuff and see it get hit for the new rows.
The only issue I see in my sample is this weird behavior where even though the ProductName column is the one that has the error, the error border is around the Checkbox in the Discontinued column. I can understand why there is no border around the ProductName cell since when the cell is not in edit mode it is using a TextBlock control. The borders only display around the editors in the cell, not the cell itself. But there shouldn't be a border around the Checkbox since there is no error there. Entering edit mode on the Discontinued cell at this point displays the error the for ProductName column but now I can't exit edit mode since the name.
I have attached the sample I built. Can you try running it on your end and letting me know what behavior you see? Also let me know if I'm doing anything wrong compared to your application that might cause the difference in what I see versus what you said should happen. (the row disappearing but displaying the IDataErrorInfo message at the top left)