Silverlight、数据表单、自动生成字段、RIA服务和子实体

Silverlight、数据表单、自动生成字段、RIA服务和子实体,silverlight,wcf-ria-services,silverlight-toolkit,Silverlight,Wcf Ria Services,Silverlight Toolkit,我正在尝试弯曲数据表单以支持多对多和绑定子对象列表。我已经能够控制对象的显示并访问on change事件 例如: OfferEditorForm.AutoGeneratingField += new EventHandler<DataFormAutoGeneratingFieldEventArgs>(OfferEditorFormGeneratingField); 我正在抓取SelectedChanged事件,并更新视图模型中设置为表单当前项的项,如下所示: void Custom

我正在尝试弯曲数据表单以支持多对多和绑定子对象列表。我已经能够控制对象的显示并访问on change事件

例如:

OfferEditorForm.AutoGeneratingField += new EventHandler<DataFormAutoGeneratingFieldEventArgs>(OfferEditorFormGeneratingField);
我正在抓取SelectedChanged事件,并更新视图模型中设置为表单当前项的项,如下所示:

void CustomerClients_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        FrameworkElement frameworkElement = sender as FrameworkElement;
        ComboBox comboBox = (ComboBox)frameworkElement.FindName("OfferEditForm_Client");
        if (comboBox != null)
        {
            _viewModel.CustomerLoyaltyProgramOffer.Client = (CustomerClient)comboBox.SelectedItem;
            _viewModel.CustomerLoyaltyProgramOffer.CouponImage = "OMG!";
        }
    }
在本例中,当我提交更改时,CouponImage被发送到我的域服务中的更新方法,但客户端仍然为NULL

CustomerRoyaltyProgramOffer似乎没有引发notify属性更改


这是一个子对象问题吗?我这样做完全错了吗?是否必须创建整个编辑模板

您应该在Model.designer.cs中的CustomerRoyaltyProgramOffer类的客户端属性上设置[Association]属性

有关更多信息,请查看以下两个链接:

void CustomerClients_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        FrameworkElement frameworkElement = sender as FrameworkElement;
        ComboBox comboBox = (ComboBox)frameworkElement.FindName("OfferEditForm_Client");
        if (comboBox != null)
        {
            _viewModel.CustomerLoyaltyProgramOffer.Client = (CustomerClient)comboBox.SelectedItem;
            _viewModel.CustomerLoyaltyProgramOffer.CouponImage = "OMG!";
        }
    }