I want all of the cells in a column to have the same background color. Seems like it should be pretty simple but I can't find a simple solution.
Yeah, sometime in WPF the simple things can be a little more involved. To do what you want to do the best thing is to change the style for the CellValuePresenter for that Field. Field.Settings exposes a property for this called CellValuePresenterStyle. You can set this in xaml or by listening to the FieldLayoutInitialized event. e.g.:
private void XDG_FieldLayoutInitialized(object sender, FieldLayoutInitializedEventArgs e)
{
Style deptStyle = new Style(typeof(CellValuePresenter));
Setter setter = new Setter();
setter.Property = CellValuePresenter.BackgroundProperty;
setter.Value = Brushes.Yellow;
deptStyle.Setters.Add(setter);
deptStyle.Seal();
foreach (Field field in e.FieldLayout.Fields)
if (field.Name == "department")
field.Settings.CellValuePresenterStyle = deptStyle;
break;
}
Is there a way to do it in the XAML?