数据绑定 - Silverlight 数据网格绑定嵌套对象属性



我对Sivlerlight世界完全陌生,所以我需要知道一件简单的事情。

如何将嵌套对象作为项源绑定到数据网格。

我有一个班级员工,看起来像:

Public class Employee
{
public long EmployeeId
        {
            get
            {
                return this._employeeId;
            }
            set
            {
                this._employeeId = value;
            }
        }
public string EmployeeName
        {
            get
            {
                return this._employeeName;
            }
            set
            {
                this._employeeName = value;
            }
        }
 public tblDepartment tblDepartment
        {
            get
            {
                return this._tblDepartment;
            }
            set
            {
                this._tblDepartment = value;
            }
        }
}

现在类"tblDepartment"将部门名称作为其属性之一,所以我想要实现的是在Silverlight的DataGrid中显示EmployeeId,EmployeeName和部门名称。我正在使用 SilverLight 4.0。

问题是我找不到如何绑定嵌套对象属性(即对象与对象)。

谁能在这里帮助我,

提前谢谢。

你应该能够做到

{Binding Path=EmployeeObject.tblDepartment.Name}

最新更新