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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:26:24+00:00 2026-05-27T21:26:24+00:00

I have been working fine with MVVM Light on a silverlight 4 Windows Phone

  • 0

I have been working fine with MVVM Light on a silverlight 4 Windows Phone 7 project in Visual Studio 2010 and Blend 4 for sometime.
Then suddenly I start getting the “Cannot create an instance of “ViewModelLocator”” error in both VS 2010 and Blend. Can’t work out why it should appear now. Any ideas on how I can possibly track down if something somewhere has changed that I have not spotted.
The only change I made, and then put back, was to add a “d:” infront of the data context expression in one of the user controls. I had the idea of binding in design, but programmatically binding in a delayed manner at run time.

I see others have posted this problem, but the answers refer to a bug in Blend, which has apparently been fixed. Also this is occuring in VS2010 too.

App.xaml looks like

<Application x:Class="BillSplitter2.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
         xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         mc:Ignorable="d"
         xmlns:vm="clr-namespace:BillSplitter2.ViewModel"
         xmlns:converters="clr-namespace:HardMediumSoft.WP7.Tools.Converters;assembly=HardMediumSoft.WP7.Tools">


<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Resources/ResourceDictionary1.xaml"/>
        </ResourceDictionary.MergedDictionaries>
        <!--Global View Model Locator-->
        <vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True"/>
        <!--Localization String Library-->
        <local:LocalizedStrings xmlns:local="clr-namespace:BillSplitter2.Utilities"
                                x:Key="LocalizedStrings" />
        <!--Converters -->
        <converters:FloatConverter x:Key="FloatConverter" />
        <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
        <converters:StringToBrush x:Key="StringToBrushConverter" />
    </ResourceDictionary>
</Application.Resources>


<Application.ApplicationLifetimeObjects>
    <!--Required object that handles lifetime events for the application-->
    <shell:PhoneApplicationService Launching="Application_Launching"
                                   Closing="Application_Closing"
                                   Activated="Application_Activated"
                                   Deactivated="Application_Deactivated" />
</Application.ApplicationLifetimeObjects>

  • 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-05-27T21:26:25+00:00Added an answer on May 27, 2026 at 9:26 pm

    Thanks to the recommendation above, I started to investigate the constructor of my ViewModel. Although I had no errors, I did find that belnd had issues with event listeners and handlers.

    I was using the

    if (IsInDesignMode)
    {
       //populate values here for blend
    }
    else
    {
       //runtime initiation
    }
    

    to populate some values for design time. I would initiate values in the model by setting their properties. This was all fine until I started adding more complex event handling routines based on property changes.

    To rectify this and recover my ‘blendability’ I did two things!

    1. Set private fields rather than properties in the IsDesignMode section. This avoid PropertyChanged events firing.
    2. Added IsInDesignMode detection in event handlers that remained a problem and skipped any cascded updating.

    Hope this helps!

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

Sidebar

Related Questions

I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#)
I have been working on getting a basic ATL project to compile in Visual
I have an iPhone (Xcode) Project that was working fine. Something must have been
I have been working on Visual Studio 2005 since last couple of days. Till
I have been working on a upload file that works fine on localhost (windows)
I have been working on a project and it works fine on my development
I have a remoting service which uses the Windows Auth. Been working fine for
I have this classic ASP site which has been working fine until we updated
I have been working on a web services related project for about the last
I have been working with relational databases for sometime, but it only recently occurred

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.