I have a XamDataGrid in use and would like to have several Background Colors for rows, depending on f.e. a viewModels Backgroud Color Property. Here you can see how i defined it in xaml. Can u please give me some hints or sample code to solve my problem?

I am under the impression that you are looking to set multiple background colors for different cells in the same column in this case. If this is incorrect, please let me know as the following is based upon this impression.

Currently, setting the Background color on your TextColumn will blanket each of the cells in that column in the same color, and so binding that property will not help you here. Instead, I would recommend usage of the DataBound event which exists on each column in the Infragistics for Xamarin XamDataGrid.

In the DataBound event, you can check the event arguments to get the CellInfo for each cell as its underlying data is data bound. This CellInfo element has a RowItem property that you can use to get the underlying data item for your data grid's row. Checking it, you can assign a new Background to your CellInfo object based on your underlying data item or ViewModel. The following example code may help you to achieve this:

It is worth noting that the Infragistics for Xamarin XamDataGrid currently styles its rows on a cellular basis, and so if you wish to do this for your entire row, you will need to handle this event for each column in your grid.

I hope this helps. Please let me know if you have any other questions or concerns on this matter.

so syling a whole row in f.e. green background color and another row f.e. in red background color will end up like this, or? I also wondered that you can't set a row backgroundcolor or bind it to a property...

If you have another solution to set different background colors for each row, please let me know. Thank u very much!

It is a fair assumption that styling an entire row would essentially end up like this at the moment.

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.

If you would like to see a way to style the entirety of the rows in the Infragistics for Xamarin XamDataGrid, I would recommend suggesting a new product idea for this by e-mailing ideas@infragistics.com. This will place you in direct communication with our product management teams who plan and prioritize upcoming features and development based on community and user feedback.

Please let me know if you have any other questions or concerns on this mater.

args.CellInfo.RowItem is always null as args.RowObject is always null, too :( Do you have any hints solving this problem? Will RowItem only be filled when AutoGenerateColums is set to true? Sincerely, Martin

I have put together a sample project using the code that I provided above, and the behavior am seeing is that args.CellInfo.RowItem and args.RowObject are null the first few times the DataBound event fires, but these items are eventually not null. This is likely because this event will fire whenever a cell is updated, and on startup of the Xamarin XamDataGrid, these items are not yet "initialized" or assigned.

I am attaching the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.

If the project does not work correctly, this indicates either a problem possibly specific to your environment, or a difference in the DLL versions we are using. My test was performed using version 17.2.20172.2051 in Infragistics for Xamarin.Forms 2017.2.

If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.

Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one.

Please let me know if you have any other questions or concerns on this matter.