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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:46:19+00:00 2026-05-16T21:46:19+00:00

I started implementing MVVM for one of my Silverlight applications. (I’m not using any

  • 0

I started implementing MVVM for one of my Silverlight applications.
(I’m not using any toolkit).

My page contains a section with two combo boxes. Selecting an item in one of these combos triggers a search that updates a grid visible below the combos.

Each combo’s selected item is bound to a property in my view model. The setter of these properties raise the INotifyPropertyChanged property change and updates the data bound to the grid automatically.

Everything was fine until I needed to add a reset button which purpose is to reset the search parameters i.e.: each combo box should not indicate any item and the grid should be empty.

  • If the reset function in the viewmodel updates the backing fields, the UI won’t reflect the changes as RaisePropertyChanged will not be called.
  • If the reset function in the viewmodel updates the properties, the UI will reflect the changes but the grid will be updated twice: when reseting the first property to null and also for the second

Any help appreciated

/// <summary>Selected user.</summary>
public User SelectedUser
{
    get { return _selectedUser; }
    set
    {
        _selectedUser = value;
        RaisePropertyChanged("SelectedUser");

        UpdateProducts();
    }
}

/// <summary>Selected product category.</summary>
public ProductCategory SelectedProductCategory
{
    get { return _selectedProductCategory; }
    set
    {
        _selectedProductCategory = value;
        RaisePropertyChanged("SelectedProductCategory");

        UpdateProducts();
    }
}

// Reset option 1
public void Reset()
{
    _selectedUser = null;
    _selectedProductCategory = null;
    _products = null;
}

// Reset option 2
public void Reset()
{
    SelectedUser = null;
    SelectedProductCategory = null;
    // No need to update Products which has already been updated twice...
}
  • 1 1 Answer
  • 2 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-16T21:46:19+00:00Added an answer on May 16, 2026 at 9:46 pm

    This is something that really urks me in many frameworks, WPF included. What you need is some concept of delaying the response to change notifications so that the user never sees intermediate states. However, you can’t change the way WPF responds to your notifications, so the best you can do is to delay your notifications until “after the dust has settled”. In your case, you will want to change both of the backing fields before any notifications are sent. Your reset method can encode this idea as follows:

    public void Reset()
    {
        _selectedUser = null;
        _selectedProductCategory = null;
        _products = null;
    
        RaisePropertyChanged("SelectedUser");
        RaisePropertyChanged("SelectedProductCategory");
    }
    

    In my opinion, the way WPF synchronously updates the display in response to notifications of change is just plain wrong. Their DependencyProperty system gives them an opportunity to merely mark dependencies as dirty and perform recalculation at a later time.

    I use the idea of marking as dirty and asynchronous recalculation as a general solution to the problem you’ve noted in this question and these days I could not imagine programming without it. It’s a shame that more frameworks do not work this way.

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

Sidebar

Related Questions

Started using Visual Studio 2012 RC since yesterday, We have one WCF solution. Whenever
For one of my course project I started implementing Naive Bayesian classifier in C.
I have been looking at using TDD and implementing proper testing (only just started
I am just getting started implementing ICU transforms using ICU4C in a C++ program.
I have started implementing web sockets using Fleck , Now the office has a
Please excuse my ignorance, I only started coding in Silverlight recently. I tried implementing
I want to render some json data using HTML template. I haven't started implementing
I have started implementing my application using phone gap and Sencha Touch . I
I have just started implementing ISet 's instead of IList 's in my project
I have started implementing Subscriptions into my app but I cannot get the API

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.