INPC-Event显示"未找到ObservableObject.cs"

时间:2013-07-23 15:12:54

标签: c# wpf mvvm-light

如果我更改了一个TextBox,则会打开标题中的窗口。我正在使用MVVM Light。

(测试)设置:

查看

<Window ... DataContext="{Binding Source={StaticResource Locator}, Path=Main}">
    <Grid>
        <TextBox Text="{Binding Foo.Bar, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="100" Height="100" Margin="10,10,407,209" />
        <TextBox Text="{Binding Foo.Bar, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="100" Height="100" Margin="115,10,302,209" />
    </Grid>
</Window>

视图模型

public class MainViewModel : ViewModelBase
{
    private Foo _foo;

    public Foo Foo
    {
        get
        {
            return _foo;
        }

        set
        {
            Set(() => Foo, ref _foo, value);
        }
    }

    public MainViewModel()
    {
        _foo = new Foo();
    }
}

模型

public class Foo : ObservableObject
{
    private string _bar;

    public string Bar
    {
        get { return _bar; }
        set { Set(() => Bar, ref _bar, value); }
    }
}

错误消息的StackTrace显示以下内容:

  

找到源代码   “D:\ GalaSoft \ mydotnet \ MvvmLight \来源\ GalaSoft.MvvmLight \ GalaSoft.MvvmLight   (NET35)\ ObservableObject.cs'。校验和:MD5 {8e 31 66 ae cd 3b be 8f   是e7 3b 2c 73 91 a0 76}文件   “D:\ GalaSoft \ mydotnet \ MvvmLight \来源\ GalaSoft.MvvmLight \ GalaSoft.MvvmLight   (NET35)\ ObservableObject.cs'不存在。看脚本   的文件   “D:\ GalaSoft \ mydotnet \ MvvmLight \来源\ GalaSoft.MvvmLight \ GalaSoft.MvvmLight   (NET35)\ ObservableObject.cs'...查看项目   “D:\ GalaSoft \ mydotnet \ MvvmLight \来源\ GalaSoft.MvvmLight \ GalaSoft.MvvmLight   (NET35)\ ObservableObject.cs'。在项目中找不到该文件。   查看目录'C:\ Program Files(x86)\ Microsoft Visual Studio   11.0 \ VC \ crt \ src \'...查看目录'C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ VC \ crt \ src \ vccorlib \'...查看   目录'C:\ Program Files(x86)\ Microsoft Visual Studio   11.0 \ VC \ atlmfc \ src \ mfc \'...查看目录'C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ VC \ atlmfc \ src \ atl \'...查看   目录'C:\ Program Files(x86)\ Microsoft Visual Studio   11.0 \ VC \ atlmfc \ include'...活动解决方案的调试源文件设置表明调试器不会要求用户   找到文件:   d:\ GalaSoft \ mydotnet \ MvvmLight \来源\ GalaSoft.MvvmLight \ GalaSoft.MvvmLight   (NET35)\ ObservableObject.cs。调试器无法找到源   文件   “D:\ GalaSoft \ mydotnet \ MvvmLight \来源\ GalaSoft.MvvmLight \ GalaSoft.MvvmLight   (NET35)\ ObservableObject.cs'。

修改

它与解决方案上下文有关。如果我单独打开项目一切正常。还有什么想法吗?

0 个答案:

没有答案