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

  • Home
  • SEARCH
  • 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 8847551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:13:02+00:00 2026-06-14T12:13:02+00:00

my application is a basic download app that allows users to download files from

  • 0

my application is a basic download app that allows users to download files from each other (a very basic kazaa :-))

Well for each download im displaying a progressbar and i want it updated according to the real download progress.

I have an observablecollection that holds a downloadInstance object which holds a progress property.

once i update the progress property the observablecollection change event probably isnt fired and the progressbar stays without any visual progress.

here is my threadsaveobservablecollection class

public class ThreadSafeObservableCollection<T> : ObservableCollection<T>
{
    public override event NotifyCollectionChangedEventHandler CollectionChanged;

    protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
    {
        NotifyCollectionChangedEventHandler CollectionChanged = this.CollectionChanged;
        if (CollectionChanged != null)
            foreach (NotifyCollectionChangedEventHandler nh in CollectionChanged.GetInvocationList())
            {
                DispatcherObject dispObj = nh.Target as DispatcherObject;
                if (dispObj != null)
                {
                    Dispatcher dispatcher = dispObj.Dispatcher;
                    if (dispatcher != null && !dispatcher.CheckAccess())
                    {
                        dispatcher.BeginInvoke(
                            (Action)(() => nh.Invoke(this,
                                new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset))),
                            DispatcherPriority.DataBind);
                        continue;
                    }
                }
                nh.Invoke(this, e);
            }
    }

}

This is the initialization process

uploadActiveInstances = new ThreadSafeObservableCollection<instance>();
instance newInstance = new instance() { File = file, User = user };
uploadActiveInstances.Add(newInstance);

and finally here is my instance class

public class instance
{
    public FileShareUser User { get; set; }
    public SharedFile File { get; set; }
    public int Progress { get; set; }
}

how can i raise the change event once a property of an instance changes (progress++) ?

  • 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-14T12:13:03+00:00Added an answer on June 14, 2026 at 12:13 pm

    The ObservableCollection will raise an event when IT changes (e.g. items are added/removed) but not when the items it holds change.

    To raise an event when your items change, your instance class must implement the INotifyPropertyChanged interface.

    For example:

    public class instance : INotifyPropertyChanged
    {
        private int progress;
        public int Progress 
        {
            get { return progress; }
            set
            {
                if (progress != value)
                {
                    progress = value;
                    if (PropertyChanged != null)
                    {
                        PropertyChanged(this, new PropertyChangedEventArgs("Progress"));
                    }
                }
            }
        }
    
        public event PropertyChangedEventHandler PropertyChanged;
    
        /* Do the same with the remaining properties */
        public string User { get; set; }
        public string File { get; set; }
    
    }
    

    You will see that now, when you change the progress it WILL get updated in the UI.
    In the code above, since I don’t raise the PropertyChanged event for User or File, they will not get updated in the UI when you change them.

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

Sidebar

Related Questions

My fairly basic application allows users to upload avatars. The application is deployed to
I'm building a very basic online application where you can take images from a
I have an application that executes workflows using WorkflowApplication as well as doing other
I've got a basic MVC application - generated from the MVC application template. I've
i am trying to download data from a sharepoint list from a C# application.
I'm a desktop application developer. I'm creating a basic website from which to sell
I am attempting to build a very simple command line application, in Xcode, that
I recently developed a simple application for displaying a list of files to some
Background: I'm writing a Java server application that needs to perform basic interactions with
I have very basic QT application (just create to explain my problem). So here

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.