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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:05:07+00:00 2026-06-17T12:05:07+00:00

I have an MVVM Cross application running on Windows Phone 8 which I recently

  • 0

I have an MVVM Cross application running on Windows Phone 8 which I recently ported across to using Portable Class Libraries.

The view models are within the portable class library and one of them exposes a property which enables and disables a PerformanceProgressBar from the Silverlight for WP toolkit through data binding.

When the user presses a button a RelayCommand kicks off a background process which sets the property to true which should enable the progress bar and does the background processing.

Before I ported it to a PCL I was able to invoke the change from the UI thread to ensure the progress bar got enabled, but the Dispatcher object isn’t available in a PCL. How can I work around this?

Thanks

Dan

  • 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-17T12:05:09+00:00Added an answer on June 17, 2026 at 12:05 pm

    If you don’t have access to the Dispatcher, you can just pass a delegate of the BeginInvoke method to your class:

    public class YourViewModel
    {
        public YourViewModel(Action<Action> beginInvoke)
        {
            this.BeginInvoke = beginInvoke;
        }
    
        protected Action<Action> BeginInvoke { get; private set; }
    
        private void SomeMethod()
        {
            this.BeginInvoke(() => DoSomething());
        }
    }
    

    Then to instanciate it (from a class that has access to the dispatcher):

    var dispatcherDelegate = action => Dispatcher.BeginInvoke(action);
    
    var viewModel = new YourViewModel(dispatcherDelegate);
    

    Or you can also create a wrapper around your dispatcher.

    First, define a IDispatcher interface in your portable class library:

    public interface IDispatcher
    {
        void BeginInvoke(Action action);
    }
    

    Then, in the project who has access to the dispatcher, implement the interface:

    public class DispatcherWrapper : IDispatcher
    {
        public DispatcherWrapper(Dispatcher dispatcher)
        {
            this.Dispatcher = dispatcher;
        }
    
        protected Dispatcher Dispatcher { get; private set; }
    
        public void BeginInvoke(Action action)
        {
            this.Dispatcher.BeginInvoke(action);
        }
    }
    

    Then you can just pass this object as a IDispatcher instance to your portable class library.

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

Sidebar

Related Questions

I am developing an app using Windows Phone 7. I have used MVVM for
I have an MVVM application. In one of the ViewModels is the 'FindFilesCommand' which
I have a simple MVVM application. It contains a property, which I will change
I have a WPF application that mostly follows MVVM, which I am trying to
I have a MVVM application which loads data via a XML on a server.
I have a large MVVM-type solution which I originally wrote using VS2010 Express with
I have large WPF-MVVM application in which I have 1 subscribe and 2 publish
I'm using MVVM Light toolkit (which I love). I currently have messaging in place
I have an MVVM application that uses a listbox which is populated with images.
I have a MVVM application and I want to keep track of the focused

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.