我正在创建一个Timesheet应用程序,其中有员工列表以及要分配时间的Codings列表。WPF .Net 4.0 MVVM将DataGrid单元格绑定到数组元素对象
我创建了一个二维码和我有网格看蛮好EXCEPT的时间
网格中的数据录入看起来像
Work Coding | AL | Sick | Job1 | Job2
____________________________________________
Employee1 | | | |
Employee2 | | | |
public class DataMatrix : IEnumerable
{
public List<MatrixColumn> Columns { get; set; }
// public List<object[]> Rows { get; set; }
public List<TimesheetDetail[]> Rows { get; set; }
IEnumerator IEnumerable.GetEnumerator()
{
return new GenericEnumerator(Rows.ToArray());
}
}
数据网格的ItemsSource是TimesheetArray。
我遇到的问题是,当我输入数据Employee1作业1 DataGrid的样子
Work Coding | AL | Sick | Job1 | Job2
____________________________________________
Employee1 | 2 | 2 | 2 | 2
,我想它看起来像
Work Coding | AL | Sick | Job1 | Job2
____________________________________________
Employee1 | | | 2 |
数据模板看起来像
<DataTemplate x:Key="TimesheetEntryDetailCellTemplate"
DataType="{x:Type data:TimesheetDetail}">
<Grid>...
<Label Content="ST" />
<TextBox x:Name="txtStandardTime"
Text="{Binding Path=HoursWorked, ...}"></TextBox>
</Grid>
</DataTemplate>
随着调试我得到一个TimesheetDetail []对象绑定到
我想,我需要这样的东西
<TextBox Text="{Binding Source = TimesheetDetail[ColumnDisplayIndex].HoursWorked}" />
有谁知道我怎样才能得到的细胞模板绑定到它钩住???元素
由于提前