Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1690
ActiveDataItem for new added record
posted

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

Parents
No Data
Reply
  • 1690
    posted

    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.


    Thanks,

    Ed

Children