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
15
How can I get the CellValuePresenter for each cell of a XamDataGrid which is inside an Unbound cell of another XamDataGrid and is using ExpandedCellPresenter?
posted

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?

  • 34430
    Offline posted

    Hello Matt,

    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.