Hi,
We are using XAMGrid and we want to add rectangle in One column, suppose we have column RectColor and in this column we want to add rectangle cotroll
We have color code in data so while binding of XAMgrid want to bind background color of rectangle.
Suppose we have two color code(red, Blue) in data the result would be one rectangle Background Red and other one would be blue.
Thanks
Hello kanwar,
Thank you for your post.
I have been investigating into the requirement that you have, and I would recommend that you use a TemplateColumn for this. Here is a link to our online documentation about creation of a TemplateColumn in the xamGrid: http://help.infragistics.com/doc/WPF/2015.2/CLR4.0/?page=xamGrid_Create_a_Template_Column.html. Using this TemplateColumn, you can define an ItemTemplate and craft a DataTemplate in which you can place your Rectangle. The elements that are placed in this ItemTemplate will have a data context of the data item that makes up the row in your XamGrid, and so you can bind the Fill of this Rectangle to your color code via the property on your data item.
Another option here would be to not use a Rectangle, but just color the entirety of the cell. If you were to define an UnboundColumn in the XamGrid's Columns collection, you could write a style for CellControl, which you could then apply to the CellStyle property for that column and bind the background color of the cells in that column to your color code in this style. Note, that the cells inside of an UnboundColumn will not have the data context of your data item directly. Instead, it has a RowData property, which returns the data item that is represented by the XamGrid row in which each of the cells are placed. So, if you bind the Background of your CellControl in your style to {Binding RowData.PropertyName}, where PropertyName is the name of the color, you can bind your cell background that way.
I have attached a sample project to demonstrate both above procedures. I hope this helps you.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support