Hello!
We need to show a button within a single cell. This depends on the bound field. If the bound object is of a certain type, a button needs to be shown. But this cannot be set for the field (column) because this may happen only once in a column and once in a row.
I was playing around with CellValuePresenter, but I was not able to change the control within the cell.
I did not find a solution? Does anyone has an idea?
Thanks in advance!
Florian
Hello Florian,
Retemplating the CellValuePresenter is the right approach to take if you want to change the content of a cell and embed a control. You can attach a sample project or provide us with the code that you are trying and we can look into it.
Hey Alex!
Please find the sample project attached.
I create a mixed list of DataObjectInt and DataObjectString. The list is attached to the DataSource property of the XamDataGrid.
The grid should display the DataObjectInt as a label with a blue background. Is not working!
The DataObjectString should displayed as a button. Is also not working. For the sake of simplicity I added a property "ShowButton" to the data objects. But in my real world scenario, the decision whether the cell is displayed as button or not needs to be made depending on the type of the data object.
Thanks for further assistance,