【问题标题】:Entity graphy binding not working in deep level实体图绑定无法在深层工作
【发布时间】:2010-11-08 20:25:39
【问题描述】:

假设我有像这样的实体图

人->学生

然后在 xaml 中,我有以下类型的绑定(人是 VM 的属性):

<TextBox  Text="{Binding People.Name, Mode=TwoWay}" />
<TextBox  Text="{Binding People.Student.StudentNo, Mode=TwoWay}" />   <!--  this bounding is not working -->

在 VM 中,实现 IEditableObject。我有一些类似的代码:

public void BeginEdit()
{
   ((IEditableObject)this.People).BeginEdit();
   ((IEditableObject)this.People.Student).BeginEdit();    //this code not working
   //....
}

运行应用时,绑定到 People 的所有数据都可以。

绑定到 Student 的所有数据都不起作用。

如何解决?

【问题讨论】:

    标签: data-binding silverlight-4.0 wcf-ria-services


    【解决方案1】:

    我猜客户端的 Student 属性为空。您需要将 [Include] 属性添加到服务器端的 Student 属性,以便 RIA 服务将其传递到客户端。您可能还需要为您的服务器端添加一个包含以从数据库中检索它,具体取决于您的数据访问的编写方式。

    【讨论】:

      猜你喜欢
      • 2018-11-17
      • 2016-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-28
      • 1970-01-01
      相关资源
      最近更新 更多