开发者

Why is WCF Service is returning a PropertyChanged value to Silverlight application?

I have a Silverlight 4 application that retreives data via WCF Web Service. The WCF Web Service pulls data from a .Net XML Web Service. The XML Web Service works fine as it is used in other projects. The application was able to retreive data with no problems until after some changes it started throwing this error:

Type 'System.ComponentModel.PropertyChangedEventHandler' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.

I have not marked anything with INotifyPropertyChanged or ...Changing.

I created a test web page in the hosting web application project and the data returns without error. I can step through the WCF service and see that the data has been retreived correctly.

Here is the calling code:

private void LoadJob()
{
    this.busyIndicator.BusyContent = "Loading job...";
    this.busyIndicator.IsBusy = true;
    var client = new BOMViewerServiceReference.BOMViewerServiceClient();
    client.GetJobCompleted += new EventHandler<BOMViewerServiceReference.GetJobCompletedEventArgs>(client_GetJobCompleted);
    client.GetJobAsync(this.jobNumberTextBox.Text.Trim());
}

void client_GetJobCompleted(object sender, BOMViewerServiceReference.GetJobCompletedEventArgs e)
{
    if (e.Error != null)
    {
        this.busyIndicator.BusyC开发者_StackOverflow社区ontent = "Busy...";
        this.busyIndicator.IsBusy = false;
        MessageBox.Show(e.Error.ToString());
        return;
    }
    //Load your data here and assign the result to the CollectionViewSource.
    var partViewSource = (CollectionViewSource)this.Resources["jobHeadViewSource"];
    partViewSource.Source = e.Result;
    this.busyIndicator.BusyContent = "Busy...";
    this.busyIndicator.IsBusy = false;
}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜