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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dynamically Highlight a specific row on a GridDataControl

Thread ID:





119383 Jun 12,2015 03:56 PM UTC Jun 16,2015 06:52 PM UTC WPF 3
Tags: GridDataControl
Ari Case
Asked On June 12, 2015 03:56 PM UTC

When you click or select a record on a GridDataControl, that row becomes the active row and is highlighted.

I'm trying to utilize the event that highlights a row on the GridDataControl after selecting.

I ultimately want to dynamically choose which row I want highlighted based on a specific value, but I'm not sure what event does this.

Any help is appreciated, thanks!

Ashok N [Syncfusion]
Replied On June 15, 2015 12:58 PM UTC

Hi Ari,

Thank you for contacting Syncfusion support.

We have analyzed your query and you can achieve your requirement by handling QueryCellInfo event, within this event you can set the Background for selected row by using GridDataControl.Model.Options.HighlightSelectionBackground property. For your refer we have attached the sample in the below sample link, please refer it.

public MainWindow()



    grid.Loaded += grid_Loaded;


void grid_Loaded(object sender, RoutedEventArgs e)


    this.grid.Model.QueryCellInfo += Model_QueryCellInfo;


void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)


    if (e.Style.RowIndex > 0)


        var column = this.grid.VisibleColumns["EmployeeID"];

        int index = this.grid.VisibleColumns.IndexOf(column);

        var visiablecolumnindex= this.grid.Model.ResolveVisibleColumnIndexToPosition(index);

        var cell = this.grid.Model[e.Style.RowIndex, visiablecolumnindex].CellValue;

        var result = Convert.ToInt32(cell);

        if (result % 3 == 0)


            this.grid.Model.Options.HighlightSelectionBackground = Brushes.Green;



            e.Style.Enabled = false;



Sample link: http://www.syncfusion.com/downloads/support/forum/119383/ze/BackgroundColor1819005304

Please let us know if you require further assistance on this.



Ari Case
Replied On June 15, 2015 04:35 PM UTC

This helps but I'm trying to programmatically check for a specific value in a cell.

For example, as I loop through the grid, if column 3 equals "Hello" at row index 4, highlight that whole row.

Ashok N [Syncfusion]
Replied On June 16, 2015 06:52 PM UTC

Hi Ari,

Thank you for update.

We have analyzed your query but we are unable to understand your requirement clearly. In our previous update itself we have highlight the whole row based on the cell value only. Could you please share more details regarding your requirement, that would be more helpful for further analyze.

Please let us know if you require further assistance.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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