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 6058113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:33:50+00:00 2026-05-23T08:33:50+00:00

So I have columns defined like this: <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBox Text={Binding Path=COLUMN_NAME, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}

  • 0

So I have columns defined like this:

                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding Path=COLUMN_NAME, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>

TextBox isn’t the only control that may exist in the DataTemplate for a column, I have DateTimePickers, ComboBoxes, etc.

And what I want to do is define some style triggers like this that access some property in the DataRow:

            <Style TargetType="{x:Type TextBox}">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding  RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGridRow}}, 
                        Path=Row.RowState}" Value="Modified">
                        <Setter Property="Foreground" Value="LightGreen" />
                    </DataTrigger>
                </Style.Triggers>
            </Style>

Now unfortunately it would appear the TextBoxes are never logical children of DataGridRows. So what is the solution? Of course I can create a trigger that targets DataGridRows themselves, but this is redundant because setting the foreground property will do nothing (TextBoxes and other controls sit in front).

Any help most appreciated.
Fugu

EDIT: Here is the solution I chose, because RowState does not notify its listeners and extending DataRow is problematic.

1) Bind an event to the control(s) for when their data changes.
2) Refresh the Style to check for the RowState again:

        Style s = ((TextBox)sender).Style;
        ((TextBox)sender).Style = null;
        ((TextBox)sender).Style = s;

Obviously it will be made more generic than that.

edit 2: This blatantly won’t work as I’d need to reset the style for each control individually, which even if it was possible would be a bad thing to do

  • 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-05-23T08:33:50+00:00Added an answer on May 23, 2026 at 8:33 am

    See the following:

    https://stackoverflow.com/questions/4947918/wpftoolkit-datagrid-highlight-modified-rows

    As far as the binding, Row isn’t a property of DataGridRow, so you have to use DataContext.Row.RowState.

    With that said, WPF is unable to detect changes to the RowState property, so your best bet is probably to wrap your items in a view model, rather than directly binding to the DataTable.

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

Sidebar

Related Questions

I have two columns in Excel, like this: A B 0.5 0.4 0.6 0.59
I have model Products with columns: name, number, description Index defined for this model
We've got a view that's defined like this CREATE VIEW aView as SELECT *
In MSSQL I have a table created like this: CREATE TABLE [mytable] (fkid int
I have a sql_query for a source defined like so: sql_query = SELECT \
I'm running Oracle 10g and have columns with Type_Name TIMESTAMP(6) WITH TIME ZONE When
I have 62 columns in a table under SQL 2005 and LINQ to SQL
I have three columns in my table - company_name, first_name, last_name . In the
I have 12 columns separated by a tab. How can I join them side-by-side?
I have a GridView A that have many columns, one of those contains price

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.