2012-06-23 21 views
1

好傢伙我試圖編輯我的UI時,面臨着一個孤立的異常IsolatedStorageException在Designview

它說

無法確定呼叫者的應用程序標識。在 System.IO.IsolatedStorage.IsolatedStorage.InitStore在 「類文件NAME.cs」

(IsolatedStorageScope 範圍,類型appEvidenceType)在 System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope 範圍,類型applicationEvidenceType)

當我嘗試這樣做

<data:scheduledItems x:Key="alarmCollection" /> 
</phone:PhoneApplicationPage.Resources> 

我用它來綁定數據。它可以工作,但我不能做任何事情,我的設計視圖

謝謝!

回答

3

在我看來,Visual Studio試圖從孤立存儲中檢索數據,但它不能,因爲它是Visual Studio而不是你的應用程序。如果您仔細考慮它是有道理的 - 隔離存儲只能在應用程序部署到Windows Phone之後創建,而不是在此之前創建。它在設計視圖中不可用。

如果您想要在設計視圖中顯示此數據,則不能。但是您可以檢查是否連接了設計視圖,並避免以這種方式訪問​​獨立存儲。

using System.ComponentModel; 

... 

if (DesignerProperties.IsInDesignView) 
{ 
    // return dummy data for the design view 
} 
else 
{ 
    // grab data from isolated storage 
} 
1

您無法從Visual Studio訪問隔離存儲。 您需要在後面的代碼中添加支票DesignerProperties.IsInDesignTool ....

if (!DesignerProperties.IsInDesignTool) 
{ 
schedulesItems = IsolatedStorageSettings.ApplicationSettings; 
} 
相關問題