本文介绍了"无法确定呼叫者&QUOT的应用程序标识;对于ViewModelLocator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在App.xaml中,我有一个错误在定义ViewModelLocator。应用程序启动并运行良好,但它让我很烦,在Studio。想知道,有什么可以成为理由。亮的行是



 < VM:ViewModelLocator X:键=ViewModelLocatorD:IsDataSource =真/> 



错误:



If to get inside of vm:ViewModelLocator, there's no sign of errors there. Should i re-check all my viewmodels and add IsoStorage designtime protection?

if (!System.ComponentModel.DesignerProperties.IsInDesignTool)
{
    settings = IsolatedStorageSettings.ApplicationSettings; 
}
解决方案

In case someone has the same issue. Just recommendation: try to open your project in Blend and attach VS to it. You'll immediately see, where problem is (usually, it is about accessing IsoStorage during designtime).

EDIT: to be more accurate, adding DesignMode check solves my problem with highlighting.

public ViewModelLocator()
    {
        if (ViewModelBase.IsInDesignModeStatic)
            return;

    ****

这篇关于&QUOT;无法确定呼叫者&QUOT的应用程序标识;对于ViewModelLocator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 04:02