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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:54:21+00:00 2026-06-01T03:54:21+00:00

I have a WPF DataGrid who’s data source is an ObservableCollection. It is set

  • 0

I have a WPF DataGrid who’s data source is an ObservableCollection. It is set up loosely as the following:

public class ItemDataCollection : ObservableCollection<ItemData>
{
}

public class ItemData : INotifyPropertyChanged
{
    private bool _selected = true;
    public bool Selected 
    { 
        get
        {
            return _selected;
        }
        set
        {
            if (value != _selected)
            {
                _selected = value;
                NotifyPropertyChanged("Selected");
            }
        }
    }
    }


    _itemDataCol = new ItemDataCollection();
        <... fill the _itemDataCol with data here ...>
    dataGrid1.ItemsSource = _itemDataCol;

When the collection is updated, a dataGrid1.Items.Refresh() updates dataGrid1 nicely. However when I modify the “Selected” property of a row by checking or unchecking the checkbox in the row corresponding to that property, the item in the collection does not get updated. I looked into the CollectionChanged event of the ObeservableCollection, but that is not appearing to get triggerd. What wiring do I need to get the dataGrid1 to update the collection.

Update

All I was doing was setting the ItemSource property to the ObservableCollection and letting the columns auto-generate. I have since changed to bind directly, and found more detail to the problem. When I simply check the box – no notification is triggerd. However if I hit after checking the box, then the collection is updated. Here is the binding:

<DataGridCheckBoxColumn Binding="{Binding Path=Selected, Mode=TwoWay}" Header="Selected"></DataGridCheckBoxColumn>

So I guess the question is how do I get the update with having to hit after checking or unchecking the box?

Update #2
(I cannot answer as my rep is not high enough yet)
OK – I think I have the solution. If I include “UpdateSourceTrigger=PropertyChanged” in the binding everything seems to work.

<DataGridCheckBoxColumn Binding="{Binding Path=Selected, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Header="Selected"></DataGridCheckBoxColumn>

Please leave comments if there are any negative affects of this that I may be missing. Thanks for the help!

  • 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-01T03:54:22+00:00Added an answer on June 1, 2026 at 3:54 am

    CollectionChanged is for Insert and Delete. NotifyPropertyChanged is for update of an items. In the posted code you don’t actually implement INotifyPropertyChanged.

       public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
    

    And I think it is cleaner to bind to a public property where you return _itemDataCol

    Otherwise the TwoWay answer of celopez3

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

Sidebar

Related Questions

I have a WPF application with a datagrid who's ItemsSource is a BindingList. When
I have a WPF DataGrid bound to ObservableCollection . Each item in my collection
I have a WPF Datagrid populated with data from one SQL table using Entity
I have created a WPF tooklit datagrid in C# and the ItemsSource is set
I have List<List<double>> with values and wpf datagrid. How can I set this as
I have WPF DataGrid (VS2010 C#). I copied the data from DataGrid to Clipboard
I have a wpf datagrid (.NET 4.0) that contains raw data from a database,
I'm using the WPF DataGrid and have it set to place a red border
I want to achieve the following: Create a WPF DataGrid that have 2 columns:
I have a WPF DataGrid with some data. You can add rows through a

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.