Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to add a DataGridTemplateColumn using a button to a WPFToolkit DataGrid that is bound to a DataTable?

Ok, so here is my goal. I have a DataGrid that is going to be bound to a DataTable.

I want to add a DataGridTemplateColumn when the DataContext changes.

For each row, I have an value that is either normal, warning, or error. If normal, I don't want a button on the column at all. If error or warning, I want a button.

So the DataTable looks something like this but in my larger app (this is a minimal example) the data is dynamic in that it can contain different numbers of rows, difference column names, etc. So a static View and static binding isn't going to work.

FieldValueCompare
a11
b23
c35
d44

So, the idea is to get the WPFToolkit's DataGrid view to look like this. If the numbers differ by 1, it is a warning. If the numbers differ by 2 it is an error.
FieldValueCompareAction
a11Normal
b23Warning
c35Error
d44Normal


I have more complete documentation here of my classes and what I have so far. I have the table displayed, and the buttons create, but I am now lost as to how to:
1. Add text to the buttons
2. Add event for on click to the buttons.

http://rhyous.com/2010/03/18/how-to-add-a-datagridtemplatecolumn-using-a-button-to-a-wpftoolkit-datagrid-that-is-bound-to-a-datatable/[^]
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900