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
Color XamDataGrid Cells dynamically from object property


I have a XamDataGrid that is bound to a collection of custom objects.  Each object contains a dictionary that acts as a holder for dynamic selected data.

public Dictionary<string,RowData> m_pricingData = new Dictionary<string, RowData>();

		public Dictionary<string,RowData> PricingData
			get => m_pricingData;
			set => SetProperty(ref m_pricingData, value);

		public class RowData : IOrm<RowData>
		public string Header { get; set; }

		public decimal Value { get; set; }

		public DateTime Date { get; set; }

		public int Peak { get; set; }

		public Color RowColor { get; set; }

		public RowData()

		public RowData(string header, DateTime date, decimal value, Color rowColor)
			Header = header;
			Date = date;
			Value = value;
			RowColor = rowColor;

 I have a user control with checkboxes that control which columns are added to the object's dictionary. When a checkbox is checked I generate a new field, set its binding to display a value taken from the dictionary.

			Field f = new Field()
				Name = name,
				BindingType = BindingType.UseAlternateBinding,
				AlternateBinding = new Binding($"PricingData[{name}].Value") //This binds the column to the appropriate dictionary value in the row's dynamic array of columns.
			//set field background color

The binding to display the data works correctly.

When I generate the Field, I want to set its background color dynamically based on a Color property in my RowData object that is part of the custom object's dictionary.

How can I set the color of the field based on the RowColor property of my RowData object?