0
gentlemens。 我在Silverlight項目如下定義,MainPage.xaml中:VS2010使用WCF加載設計時數據時的設計時錯誤
<UserControl
xmlns:model="clr-namespace:Engine.Silverlight.Web.Views;assembly=Engine.Login.Model"
d:DataContext="{d:DesignInstance Type=model:DesignTimeModel, IsDesignTimeCreatable=True}">...
和階級在Engine.Login.Model項目,該項目用於設計時數據綁定(一切工作正常進行預初始化屬性,但):
public class DesignTimeModel : INotifyPropertyChanged
{
public DesignTimeModel()
{
var d = Deployment.Current.Dispatcher;
d.BeginInvoke(
() =>
{
CacheClient c = new CacheClient();
c.GetResourcesCompleted +=(s,e)=>
{
d.BeginInvoke(
() => this.Resources = e.Result);
};
c.GetResourcesAsync();
}
);
不幸的是,我得到了WCF請求已完成(我試圖通過附加到1 VS實例過程中使用VS的不同實例來調試,但它並不能幫助後System.ObjectDisposedException - 同樣的錯誤,不附加信息):
System.ObjectDisposedException
Cannot access a disposed object.
Object name: 'Dispatcher'.
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
我假定Dispatcher在設計模式中的行爲不同。 你能幫我解決這個問題,以便在VS2010 XAML設計器中使用WCF獲取設計時數據嗎?
[鏈接](http://stackoverflow.com/questions/3236095/how-to-have-a-blendable-project-using-mvvm-light-and-wcf-ria-services) – Override 2011-04-18 13:39:07
[鏈接]( http://stackoverflow.com/questions/3236095/how-to-have-a-blendable-project-using-mvvm-light-and-wcf-ria-services) [鏈接](http://openlightgroup.net) /Blog/tabid/58/EntryId/87/Silverlight-MVVM-Enabling-Design-Time-Data-in-Expression-Blend-When-Using-Web-Services.aspx) 我看到了帶有WCF設計時間的示例列表,我不知道你爲什麼認爲它不好。 順便說一句,我按照你的建議改變了代碼 - 它沒有幫助... – Override 2011-04-18 13:44:28