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

The Archive Base Latest Questions

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

I’ve created a property IsLoading for my main view model. The idea is that

  • 0

I’ve created a property “IsLoading” for my main view model. The idea is that a progressbar is displayed whenever this property is set to true. So far so good

The catch is, that I have a command, that calls another viewmodel (the code is there because it’s a functionality from another page, but I want to be able to shortcut it as well from my main viewmodel)

So, I went ahead and modified the main property to something like this :

public const string IsLoadingPropertyName = "IsLoading";

        private bool _isLoading;

        public bool IsLoading
        {
            get
            {
                return _isLoading || ((ViewModelLocator)Application.Current.Resources["Locator"]).SettingsViewModel.IsLoading;
            }
            set
            {
                if (value != _isLoading)
                {
                    _isLoading = value;
                    RaisePropertyChanged(IsLoadingPropertyName);
                }
            }
        }

and the xaml

 <shell:SystemTray.ProgressIndicator>
        <shell:ProgressIndicator IsIndeterminate="true" IsVisible="{Binding Main.IsLoading, Source={StaticResource Locator}}" />
    </shell:SystemTray.ProgressIndicator>

So, I’m saying that main view model is loading when there’s something loading there, or if the settings view model is loading.
The problem is that the binding only works when setting the main view model’s IsLoading property, it doesn’t react when I set it in the inner IsLoading one. Both have the same property name “IsLoading”. Shouldn’t it be detected?

For example, in Main view model (just the execution of the command for simplicity) :

    private void ExecuteRefreshCommand()
    {
        ViewModelLocator viewModelLocator = Application.Current.Resources["Locator"] as ViewModelLocator;
        viewModelLocator.SettingsViewModel.GetCurrentLocationCommand.Execute(null);
    }

and inside the settings view model :

public RelayCommand GetCurrentLocationCommand
        {
            get
            {
                Action getLocation = () =>
                {
                    if (!NetworkInterface.GetIsNetworkAvailable())
                    {
                        return;
                    }

                    var watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
                    watcher.PositionChanged += WatcherPositionChanged;
                    IsLoading = true; // settings view model "IsLoading" propertychanged raising property
                    watcher.Start();
                };
                return new RelayCommand(getLocation);
            }
        }
  • 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-01T05:54:54+00:00Added an answer on June 1, 2026 at 5:54 am

    You’re looking at the MainViewModel’s isLoading property to determine whether to show the progressbar or not. Silverlight uses the NotifyPropertyChanged event to determine when it should reevaluate a certain property. When setting either the SettingsViewModel’s IsLoading property- or the MainViewModel’s property, you only raise the changedEvent for that ViewModel. You should raise the ChangedEvent for both.

    A modified setter example could be (depending on the exposed methods)

    set 
    { 
        if (value != _isLoading) 
        { 
            _isLoading = value; 
            RaisePropertyChanged(IsLoadingPropertyName); 
            ((ViewModelLocator)Application.Current.Resources["Locator"]).SettingsViewModel.RaisePropertyChanged(IsLoadingPropertyName);
        } 
    } 
    

    Note that many MVVM frameworks offer a functionality called Messaging which is ideal to do cross ViewModel communication without creating the strict dependency you created right now. Alternatively you can use a globally consumed IsLoading property.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping 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.