XamDataGrid 13.1, selecting first record

Answered (Verified) This post has 1 verified answer | 1 Reply | 1 Follower Thread's RSS feed.

michaeldjackson_ut
Points 1,330
Replied On: Mon, Sep 23 2013 2:39 PM Reply

In my app, I have a main XamDataGrid, which contains records, and these records contains several child objects. I am not using the heirarchial panels in the grid due to user requirements...the child grids are elsewhere on the form.

When I load the form, I programitically select the first record in the parent grid, and populate the child grids with child records.

When I click into the first cell of a new row, the child objects are cleared, of course.

This all works fine, except when I click in the first cell on the new record on the parent grid (xamDataGridPumpingStages), then begin typing, only 1 character is accepted before the grid accepts the row (I quess), and the newly added row is no longer active/focused. I have to click into the first cell to finish editing.

I am using this code:

private void xamdDataPumpingStages_RecordAdded(object sender,  Infragistics.Windows.DataPresenter.Events.RecordAddedEventArgs e)

{

Record r = e.Record();

DataRecord dr = (DataRecord)r;

viewModel.CurrentProject.CurrentPumpingStage = (UTEFPumpingStage)d.DataItem;

}

private void xamDataGridPUmpingStages_InitializeRecord(object sender,  Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs e)

{

xamDataGridPumpingStages.Records[0].IsActive = true;

xamDataGridPumpingStages.Records[0].IsSelected = true;

xamDataGridPUmpingStages.ActiveRecord = xamDataGridPumpingStages.Records[0];

}

private void xamDataGridPumpingStages_RecordsActivated(object sender,  Infragistics.Windows.DataPresenter.Events.RecordActivatedChangedEventArgs e)

{

if (((XamDataGrid)sender).ActiveRecord == null)

{

return;

}

Record r = ((XamDataGrid)sender).ActiveRecord;

DataRecord dr = (DataRecord)r;

viewModel.CurrentProject.CurrentUTEFPumpingStage = (UTEFPumpingStage)dr.DataItem;

if (viewModel.CurrentProject.CurrentUTEFPumpingStage != null)

{

viewModel.GUI_Builder_Pane_Tab_Reservoir_Expander.FluidAndProppant_Title = viewModel.CurrentProject.CurrentUTEFPumpingStage.StageName;

GenerateMassFractionsGrid();

}

}

  • Post Points: 5

Verified Answer

michaeldjackson_ut
Points 1,330
Answered (Verified) Replied On: Mon, Sep 23 2013 3:26 PM Reply
Verified by [Infragistics]Stefan

Disregard this question. I resolved the issue.

I moved the three lines of code in the InitializeRecord function to where I open the data file, so this code is run once the objects are populated.

  • Post Points: 25
Page 1 of 1 (2 items) | RSS