Hi.
I have two quick questions. 1. Is there a nice way to set the maximum number of characters allowed in a field in a datagrid(when the type is String)? That is so that input is limited to the number of chars, without using a converter to validate after the text is inputed?
2. Is there a good way to let the grid update it's bound data on UpdateSourceTrigger=PropertyChanged rather than lost focus?
I know it's possible with some "hacking" using the CellChanged event, but is there a cleaner way to do this? (Still want the converters etc to do their job, would forinstance somewhat solve issue nr 1)
We have problems with the XamDataGrid due to the latter issue. The grids in our views doesn't receive the lostfocus event, and there for the ui hasn't updated the source wich causes data to be missed.
Best regards,
Stian
Hi,
I am just following up on this forum thread. Please let me know if I can provide further assistance. Sincerely, Matt Developer Support Engineer
HI,
You should consider using the XamDataGrid's DataPresenterComands.
You could execute the CommitChangesToActiveRecord or CommitChangestoAllRecords.
The commands can be executed by calling the XamDataGrid’s ExecuteCommand method.
Here is a help link to the DataPresenterCommands http://help.infragistics.com/NetAdvantage/WPF/2010.3/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v10.3~Infragistics.Windows.DataPresenter.DataPresenterCommands_members.html
Here is a help link to the ExecuteCommand method. http://help.infragistics.com/NetAdvantage/WPF/2010.3/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v10.3~Infragistics.Windows.DataPresenter.DataPresenterBase~ExecuteCommand.html
Sincerely, Matt Developer Support Engineer
I am a bit confused regarding your application. Is this an Xbap application that has XamDataGrid?
How can you have code behind? Can you give me more information regarding your application?
Hello Matt,
Thank you for your response, we were able to solve this one issue with the information you gave us.
Do you by chance know of a good solution to our updatesource problem?
As I mentioned earlier our view is made up from different overviews and detailviews. When the user clicks etc outside a view with a grid, the components does not lose focus. This results in that the source isn't updated when forinstance the user clicks on a save button outside the view. (This is an xbap application and the views are defined in different dll files).
We have been able to resolve this issue with a "hack" where we hook onto the CellChanged event and then doing a e.Cell.Value = e.Cell.Text when the ValueType is a String. Is there a cleaner way to force the grid to update its sources?
As far as setting a max character size for the XamDataGrid. This could be done by creating a style that targets the XamTextEditor, which is the default editor for string data. You could set the editors ValueConstraint's maxLength property. Here is a help link: http://help.infragistics.com/NetAdvantage/WPF/2010.3/CLR4.0/?page=InfragisticsWPF4.Editors.v10.3~Infragistics.Windows.Editors.ValueEditor~ValueConstraint.htmlSincerely, Matt Developer Support Engineer