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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:43:49+00:00 2026-06-10T19:43:49+00:00

I have xamDataGrid bound to DataTable where first column contains reference values. Coloring of

  • 0

I have xamDataGrid bound to DataTable where first column contains reference values. Coloring of all other columns depends on whether the value in cells is or isn’t equal to the value of reference column. The logic uses converter.

What I want to achieve is when I move another column to the 1st position, it will become the reference column and the colors in all other columns should change.

I’m listening to FieldPositionChanged event and invalidating the grid layout, but it does not work:

grid.UpdateLayout();
grid.InvalidateVisual();

The breakpoint in converter is hit but not for all records (only 2 or 3).

  • 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-10T19:43:51+00:00Added an answer on June 10, 2026 at 7:43 pm

    If you set the CellValuePresenterStyle when the fields move they should update correctly. The following logic will do this:

    void XamDataGrid1_FieldPositionChanged(object sender, Infragistics.Windows.DataPresenter.Events.FieldPositionChangedEventArgs e)
    {
        FieldLayout layout = e.Field.Owner;
        Field first = null;
        foreach (Field f in layout.Fields)
        {
            if (f.ActualPosition.Column == 0)
                first = f;
        }
        if (first != null)
        {
            SetCellValuePresenterStyle(e.Field.Owner, first);
        }
    }
    
    void XamDataGrid1_FieldLayoutInitialized(object sender, Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs e)
    {
        SetCellValuePresenterStyle(e.FieldLayout, e.FieldLayout.Fields[0]);
    }
    
    void SetCellValuePresenterStyle(FieldLayout layout, Field sourceField)
    {
        Binding sourceValueBinding = new Binding("DataItem[" + sourceField.Name + "]");
        foreach (Field f in layout.Fields)
        {
            if (f != sourceField)
            {
                Style cellValuePresenterStyle = new Style(typeof(CellValuePresenter));
                Binding compareValueBinding = new Binding("DataItem[" + f.Name + "]");
                MultiBinding styleBinding = new MultiBinding();
                styleBinding.Bindings.Add(sourceValueBinding);
                styleBinding.Bindings.Add(compareValueBinding);
                styleBinding.Converter = new EqualMultiValueConverter();
                DataTrigger trigger = new DataTrigger();
                trigger.Value = true;
                trigger.Binding = styleBinding;
                cellValuePresenterStyle.Triggers.Add(trigger);
                Setter backgroundSetter = new Setter(Control.BackgroundProperty, Brushes.Green);
                trigger.Setters.Add(backgroundSetter);
                f.Settings.CellValuePresenterStyle = cellValuePresenterStyle;
            }
            else
            {
                f.Settings.CellValuePresenterStyle = null;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to create a XamDataGrid that shows a dynamic amount of columns for
So I have a simple window which contains only a XamDataGrid that holds preview
We have a Infragistics xamDataGrid with the DataSource bound to a BindingList. We have
I have a xamDataGrid with two levels of data. (see other question on SO).
I have two decimal datatype columns; I want them displayed like so: Column 1
Have deployed numerous report parts which reference the same view however one of them
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
We have a single table (25 columns int, text and datetime) with about a
Have a rather abstract question for you all. I'm looking at getting involved in
I have a XamDataGrid (version 2011.2) in a WPF application, when a user has

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.