I have a grid which has a number of child grids. I need to hide/change other field properties using code. I am a little lost when/how to do this. I bind the datasource in code. After setting datasource I only see one fieldLayout. Any help will be greatly appreciated.
Thanks
That's good news.
Please don't forget to give us your feedback on any new features/controls that you would like to see in our future releases on the link below:
http://devcenter.infragistics.com/Protected/RequestFeature.aspx
Thanks!
I updated to 9.2 and referenced those dlls. And the issue where I have to expand row twice to show child grids is gone. They show up after first time.
PS:
The features you added to the grid in 9.2 are excellent. A lot of the features were ones I wished that were in 9.1. Good Job.
the code is not in a grid event. The code is on a finish event of a wizard control. When finish button is pressed the code that pretains to setting up grid is:
private void setupFinishGrid() { xamDGFinish.FieldLayoutSettings.AutoArrangeCells = Infragistics.Windows.DataPresenter.AutoArrangeCells.Never; xamDGFinish.AutoFit = true; xamDGFinish.DataSource = _lcwCol; foreach (Field f in xamDGFinish.FieldLayouts[0].Fields) { switch (f.Name) { case "NewLaborCategory": f.Visibility = Visibility.Visible; f.Label = "Labor Category"; f.Row = 0; f.Column = 0; break; case "MatchedContractorCategory": f.Visibility = Visibility.Visible; f.Label = "DCS Labor Category"; f.Row = 0; f.Column = 1; break; case "Files": f.Visibility = Visibility.Visible; break; case "ChosenPastPerformances": f.Visibility = Visibility.Visible; f.Label = "Past Performances"; break; default: f.Visibility = Visibility.Collapsed; break; } } }
By default XamDataGrid uses virtualization techniques and that is why FieldLayouts are generated/destroyed when they are expanded/collapsed. To turn off this virtualization, you can change the RecordContainerGenerationMode, which is not recommended if you have a lot of data in the XamDataGrid.
Regarding this code snippet, which event are you using to execute this code in ?
Currently, grouping can be performed only on the parent layout and not any child one. In version 9.2, which by the way is just around the corner, you will be able to GroupBy any fieldlayout you like.
Well that answers why the field layout is not generated when I set datasource. Is there a way to expand/collapse child records? (To generate layouts.)
I got another problem. I set the visiblity of fields like this:
foreach (Field f in xamDGFinish.FieldLayouts[0].Fields) { switch (f.Name) { case "NewLaborCategory": f.Visibility = Visibility.Visible; f.Label = "Labor Category"; f.Row = 0; f.Column = 0; break; case "MatchedContractorCategory": f.Visibility = Visibility.Visible; f.Label = "DCS Labor Category"; f.Row = 0; f.Column = 1; break; case "Files": f.Visibility = Visibility.Visible; break; case "ChosenPastPerformances": f.Visibility = Visibility.Visible; f.Label = "Past Performances"; break; default: f.Visibility = Visibility.Collapsed; break; } }
When I run the program and expand the row it expands but no child records show. I collapse and expand again and child records show up. If I comment out the for loop it shows child records the first time. Any suggestions?
And is there a way to set a grouping in a child grid?