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
390
Different UserControl in a cell for each row
posted

Hi All,

I've got a collection of Question objects, and each question object has child Answer Object, each answer object could be a different class.  

Is it possible to display a different user control in the cell for each row in a grid.  What i'm trying to do is have a grid with the first column showing the QuestionText and the second column showing the answer, but the second column needs to display the information differently depending on the AnswerObject type. 

Is this possible using xam datagrid?

Thanks

Parents
No Data
Reply
  • 2426
    Suggested Answer
    posted

    Hello,

    Theoretically, you could use a DataTrigger as a part of the CellValuePresenterStyle or EditorStyle to set the Template (and/or EditTemplate for the Editor) to your UserControl depending on a property of your underlying Object's value for that Field. You can see this documentation for more information on styling the XamDataGrid. For more information on DataTriggers, please see this documentation.

Children
No Data