WPF Injected Locator, DesignerProperties.IsInDesignTool missing

Dec 16, 2011 at 3:01 AM

Has anyone tried using the injected locator in a Simple-Mvvm WPF Application?

The Simple-Mvvm template code generated for the constructor in the view model injected locator doesn't compile. 


        public ViewModelInjectedLocator()
            // Only inject service agents at runtime
            if (!DesignerProperties.IsInDesignTool)
                // Use MEF to inject service agents
                CompositionHost.Initialize(new DeploymentCatalog());

                // TODO: Verify creation of service agents


The following error is reported on the "IsInDesignTool" property:

Error 3 'System.ComponentModel.DesignerProperties' does not contain a definition for 'IsInDesignTool' C:\dev1\Mvvm2\App1\Locators\ViewModelInjectedLocator.cs 78 37 App1


System.ComponentModel.DesignerProperties doesn't have a "IsInDesignTool" property:


#region Assembly PresentationFramework.dll, v4.0.30319
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\PresentationFramework.dll

using System;
using System.Windows;

namespace System.ComponentModel
    public static class DesignerProperties
        public static readonly DependencyProperty IsInDesignModeProperty;

        public static bool GetIsInDesignMode(DependencyObject element);

        public static void SetIsInDesignMode(DependencyObject element, bool value);



Jan 6, 2012 at 2:01 PM

Yes, the code needs to be changed for WPF to use IsInDesignMode.