Is there a way to specify alternate row background color ?
Row styling was previously discussed on the following thread:
The Infragistics for Xamarin XamDataGrid does not currently really have a way to style the entirety of a "Row" as the styling is currently done on a cell-by-cell basis. That said, if you style all of the cells of a particular row using the event mentioned above on each of the columns in your grid, you can essentially style the entire row.
You can suggest new product ideas for future versions (or vote for existing ones) at <https://www.infragistics.com/community/ideas>. Submitting your idea will allow you to communicate directly with our product management team, track the progress of your idea at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you. Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. You can also link back to this thread for additional details.
Please let me know if you have any other questions or concerns on this mater.
Thanks! I'll give that a try.
Thanks for following up. Let me know if you have any additional questions.
I've implemented the solution detailed in the thread you mentionned and it works very well.
Do you know if issue #247041 (args.CellInfo.DataRow returning -1 on horizontal scroll) has been corrected ? We don't have any cases yet of horizontally scrolling grids but may have some later in the project.
This is my implementation so far; there is a fallback for the #247041 case, should it occur, by using a RowID property of the bound data - not too fond of this as I foresee sorting the grid breaking this mecanic.
private SolidColorBrush _altRowBackground;
private SolidColorBrush _rowBackground;
public MyPage ()
_altRowBackground = GetBrush("GridRowBackground", Color.White);
_rowBackground = GetBrush("GridAltRowBackground", Color.LightGray);
MyGrid.BindingContextChanged += MyGrid_BindingContextChanged;
BindingContext = MyViewModel = new ViewModels.SomeViewModel();
private void MyGrid_BindingContextChanged(object sender, System.EventArgs e)
if (sender is XamDataGrid iGrid) BindGridColumnEvents(iGrid, true);
private bool _columnEventBound = false;
private object _lock = new object();
private void BindGridColumnEvents(XamDataGrid iGrid, bool bindEvent)
if (bindEvent == _columnEventBound || iGrid.Columns.Count == 0)
foreach (Column col in iGrid.Columns)
if (bindEvent) col.DataBound += GridColumn_DataBound;
else col.DataBound -= GridColumn_DataBound;
_columnEventBound = bindEvent;
private void GridColumn_DataBound(object sender, DataBindingEventArgs args)
if (args.CellInfo.DataRow >= 0) isAltRow = (args.CellInfo.DataRow % 2 == 0);
else if (args.CellInfo.RowItem is Models.MyModel model) isAltRow = (model.RowID % 2 == 0);
else isAltRow = false;
if (args.CellInfo.Background != (isAltRow ? _altRowBackground : _rowBackground))
args.CellInfo.Background = (isAltRow ? _altRowBackground : _rowBackground);
Thank you for the update. #247041 is currently going through testing to confirm that the fix made works.