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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:02:32+00:00 2026-06-09T18:02:32+00:00

I have an observable collection binded to a datagrid. On a datagrid row, when

  • 0

I have an observable collection binded to a datagrid. On a datagrid row, when I edit a property’s value I need another property on that row to update it’s value based on a calculation. What is the best way to go about doing this. I tried creating a collectionchanged method like below:

   Public WithEvents Tickets As ObservableCollection(Of Ticket)

Public Sub Tickets_CollectionChanged(ByVal sender As Object, ByVal e As NotifyCollectionChangedEventArgs) Handles TicketCollection.CollectionChanged
    CalculatedVariable = determineCalculation()
End Sub

However this it only called when a new item is added or deleted, not when a property within the row is edited. Another way I looked at is calling the calculation method within the setter of each property but that seems messy knowing that i would need to call that method and update the property on several different properties that I need it on. Is there a good easy efficient way that I can accomplish what I’m trying to do? Thannks for any feedback 🙂

 public property MyVariable
 Get 
     return _MyVariable
 Set(value)
     _MyVariable = value
     CalculatedVariable = determineCalculation()
     RaisePropertyChange("MyVariable") , ect..
 EndProperty
  • 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-09T18:02:34+00:00Added an answer on June 9, 2026 at 6:02 pm

    The class of the elements listed by your ObservableCollection has to implement INotifyPropertyChanged. You have to raise the PropertyChanged event in your setters. Then you can subscribe to this event inside your class and make the calculation in the callback. I find it a little bit cleaner than doing the calculation in each setter, and anyways you need to implement INotifyPropertyChanged if you want the UI to be updated when you change any property of your object.

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

Sidebar

Related Questions

I have an observable collection which is binded to datagrid... I want to sort
I have an observable collection of objects that I'd like to display on the
The situation is like this: I have an Observable Collection that has a bunch
I'm stumped here. I have an observable collection that holds business objects. I have
I have a DataGrid in WPF bound to an observable collection. In my UI
I have a observable collection exposed as a property within a view model. The
I have my class that has an internal observable collection. I want to pass
I have the following bit of code that modifies an observable collection of 'screens'
I have an method that takes in an observable collection (returned from a webservice)
I have an observable collection of Song objects. These song objects have a property

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.