绑定自定义对象Datagrid Silverlight 4
我创建了一个自定义对象,如下所示绑定自定义对象Datagrid Silverlight 4,silverlight,silverlight-4.0,Silverlight,Silverlight 4.0,我创建了一个自定义对象,如下所示 public class GridViewModel { private List _listRowCust = new List(); public List ListRowCust { get { return _listRowCust; } set { _listRowCust = value; } } } public class RowCustom { private List<
public class GridViewModel
{
private List _listRowCust = new List();
public List ListRowCust
{
get { return _listRowCust; }
set { _listRowCust = value; }
}
}
public class RowCustom
{
private List<CellCustom> _listCellCustom = new List<CellCustom>();
public List<CellCustom> ListCellCustom
{
get { return _listCellCustom; }
set { _listCellCustom = value; }
}
public RowCustom() { }
}
我找不到任何关于如何定制绑定的解释。
你知道吗
多谢各位
致以最良好的祝愿,
Alexandre我认为您只能绑定到公共属性
因此,如果是itemsSource或数据上下文使用的对象,CellCustom必须绑定到一个公共属性。示例不完整。名为
单元格的属性在哪里?为什么GridViewModel
没有为ListRowCust
使用列表?
textColumn = new DataGridTextColumn();
textColumn.Header = "RemainingWork";
textColumn.Binding = new Binding("Cell[0]"); //it's a supposed syntax possibility in fact I have 3 rows with 10 cells
GridElements.Columns.Add(textColumn);
GridElements.ItemsSource = e.GridViewModel.ListRowCust;