We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to access cell in GridDataControl

Thread ID:

Created:

Updated:

Platform:

Replies:

96394 Sep 9,2010 01:20 PM UTC Sep 12,2010 05:23 PM UTC WPF 1
loading
Tags: GridControl
Ivica Nikolic
Asked On September 9, 2010 01:20 PM UTC


Hello,

In my project I have to change the cell background color depend on value in some DataTable which is not bind to the GridDataControl. My question is how to access the cell in GridDataControl and how to change the cell color.

Criterium for changing color is different for each cell and the solution is not condtional formating from your samples. The project is WPF.

Thanks in advance

Ivica


Jeraldes J [Syncfusion]
Replied On September 12, 2010 05:23 PM UTC

Hi Nikolic,

Thank you for using Syncfusion products.

QueryCellInfo is used to provide the cell values on demand. The QueryCellInfo is used to completely customize the grid cells. The code below sets up a Virtual Grid by applying these events and also paints alternate rows using QueryCellInfo event. The QueryCellInfo event is raised for each cell that requires redrawing.
Please refer the code snippet and the sample from the following

[Code Snippet]

this.dataGrid.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if (e.Cell.ColumnIndex == 1 && e.Cell.RowIndex == 3)
{
e.Style.Background = Brushes.Brown;
}
}

Let us know if you need any other details.

Regards,
Jeraldes J




GDC-CellEdit-96394_e968942f.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;