小编use*_*765的帖子

名称空间中不存在名称ViewModelLocator

我正在学习使用MVVM Light的WPF,我的可移植类库存在问题.我遵循这个教程:http://www.codeproject.com/Articles/536494/Portable-MVVM-Light-Move-Your-View-Models

我参考MVVM Light创建了一个门户类库和一个WPF mvvm light 4.5.我在我的wpf项目中添加了我的PCL的引用.所以在我的PCL中,我添加了一个文件夹ModelView并在我的ModelViewLocator中

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc;
using Microsoft.Practices.ServiceLocation;
using EasyDevis.EasyDevisPCL.Model;
using EasyDevis.EasyDevisPCL.ViewModel.MainPage;

namespace EasyDevis.EasyDevisPCL.ViewModel
{
/// <summary>
/// This class contains static references to all the view models in the
/// application and provides an entry point for the bindings.
/// <para>
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator
{
    static ViewModelLocator()
    {
        ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
        SimpleIoc.Default.Register<MainPageViewModel>();
    }

    /// <summary>
    /// Gets the Main property.
    /// </summary>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
        "CA1822:MarkMembersAsStatic", …
Run Code Online (Sandbox Code Playgroud)

wpf mvvm-light portable-class-library

9
推荐指数
2
解决办法
1万
查看次数

标签 统计

mvvm-light ×1

portable-class-library ×1

wpf ×1