Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8762079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:26:23+00:00 2026-06-13T15:26:23+00:00

I am displaying two datatables (let’s call them left and right) in two datagrids

  • 0

I am displaying two datatables (let’s call them left and right) in two datagrids and it works. However what I want to do is to allows users compare two rows (left and right) based on the selection and change the background when the cells are different.

Sample:

Left
|A|B|C|
|1|2|3|
|1|2|3|
|1|2|3|

Right
|A|B|C|
|1|2|4|
|1|2|3|
|1|2|3|

In XAML my Datagrids look like:<DataGrid Grid.Column="0" x:Name="leftData" HorizontalAlignment="Stretch" >
</DataGrid>

And in Code I am binding the datagrid to the DataTable:

TableRows = new DataTable();
leftData.ItemsSource = TableRows;

When the user selects the first row on the left and right, the cells on column C should be marked with a red background.

How is the better approach for doing that in WPF? Is it possible to do that with DataGrid in WPF?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:26:25+00:00Added an answer on June 13, 2026 at 3:26 pm

    Finally I found the solution. The DataGrid control does not offer a way to get a DataGridCell, however it is possible to get it from the DataGrid control by using the VisualTreeHelper in order to get the DataGridCellsPresenter and from the presenter it is possible to get the DataGridCell.

    More information and the code can be found here:

    http://techiethings.blogspot.ch/2010/05/get-wpf-datagrid-row-and-cell.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with two dataTables. One of them is populated with data
I am displaying two DIV panels with the code below. The only difference between
Here i am having a unordered list displaying two columns code and name .I
I have a databound listbox which is actually displaying two columns of data. It
I have two plots displaying supply and demand, and one plot in which I
I have two images - 1)a rectangular one, displaying the actual content and 2)a
The above image is just adding two values and displaying the result on the
This jquery toggles two things. (1) A css class and (2) displaying a div.
When displaying a group of JRadioButtons, initially none of them is selected (unless you
I am using MVVM and am displaying two listboxes on one window. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.