0

I'm new to WPF, and have the following problem:

I have a ListView presented as grid. The columns of the grid are added dynamically from code behind (myDataGrid is the GridView inside myListView):

myListView.ItemsSource = myDataTable.DefaultView;

foreach (var col in myDataTable.Columns) {
    var column = new GridViewColumn();
    column.Header = col.ColumnName;
    column.DisplayMemberBinding = new Binding(col.ColumnName);                    
    myDataGrid.Columns.Add(column);
}

This works fine, i'm only having touble styling it. So how can I add a custom styling to these columns based on their values? For example, I would like that every cell that has the "0" in it to have yellow background.

4

1 回答 1

0

这不完全是您所需要的,但肯定会有所帮助:http: //highfieldtales.wordpress.com/2013/08/11/hacking-the-wpf-gridview-final-revised-release/

于 2013-08-16T16:54:13.397 回答