Hi,
I have a xamDataGrid (actually xamDataPresenter in GridView) binded to ObservableCollection and ActiveDataItem is also binded to some property in data model. Something like:
<igDP:XamDataPresenter Name="xamDataGridCompPeriods"ActiveDataItem="{Binding SelectedCompensation, Mode=TwoWay}" BindToSampleData="False" DataSource="{Binding CompensationsList, Mode=TwoWay}" GroupByAreaLocation="None">
In every row I have several buttons which are used to calculate values of the row fields. There are StartDate, EndDate and Weeks fields, each of them has corresponding button. When button is pressed, value of the field is calculated based on values of remaining fields. EndDate = StartDays + number of weeks, etc. All buttons have their CellValuePresenterStyles which are defined in XamDataPresenter.Resources. Everything works fine for existing records. However, when I am adding a new record, enter start date, weeks and try to calculate a end date ('Enter' key is not pressed) I see that property which is binded to ActiveDataItem is null and I am not able to save end date. From the other side I see that new record is already added to the end of ObservableCollection binded to the grid.
Is it a normal behavior when property binded to ActiveDataItem is null until Enter is pressed ?
Thanks,
Ed
I've found a post:
http://ko.infragistics.com/community/forums/t/39858.aspx
which suggests to use ActiveRecord instead of ActiveDataItem. I tried to do do it, but in my case ActiveRecord points to last ActiveRecord before I started to add a new one. Also I tried to use last record of my ObservableCollection, in this case I can set the new value but after pressing Enter, new record disappears from the screen.
Hello,
Thank you for your post. I have been looking into it and I can say that before the Record is added to the XamDataGrid (by pressing Enter) there is no ActiveDataItem. This is the expected behavior. Also I can say that if you use the ActiveRecord instead you would be able to change the values by getting the ActiveRecord’s Cells collection and change the specific Cell’s Value.
Hope this helps you.