Title seemed confusing to write, but I will try to explain better here.
I have a XamDataGrid with an Unbound cell. This Unbound cell contains another XamDataGrid. The inner XamDataGrid is implemented using a ControlTemplate with TargetType = ExpandedCellPresenter.
My issue is that I am unable to retrieve the CellValuePresenter of each cell in the inner XamDataGrid unless it is expanded.
I must use an ExpandedCellPresenter for this XamDataGrid. Is there a way to retrieve the CellValuePresenters without expanding?
I have done an initial investigation into the requirement you have in this case, and I would just like to ensure that I understand what is happening here.
From my understanding, it sounds like you are using an unbound Field in the XamDataGrid, likely with a CellValuePresenterStyle that is setting the Template property to contain another XamDataGrid. You mentioned that you are using an ExpandedCellPresenter, though, which I am a little unsure of in this case. It would very likely be helpful if you could please provide the XAML that you are using to place the inner XamDataGrid in your outer one.
With the above said, CellValuePresenter elements by default are only created for records that are in view, and so if this “ExpandedCellPresenter” is not expanded, they will not be created. They will be null otherwise unless you shut off the virtualization of the grid, which can lead to some rather serious performance issues, if you have a grid with a decently large data source. I have to wonder for what reason you are looking to get the CellValuePresenter elements in this case, though? Would it be possible for you to please elaborate on this bit as well, as there may exist a better way of doing what you are looking to do?
Please let me know if you have any other questions or concerns on this matter.