0
私は一日中気分が良いのを探していますが、これを解決できないように思えます。DataGridにDataGridをバインドするWPF(VB.net)
私はそうのように構築されたDataTableがあります。
Dim dtAttendanceTimes As New DataTable
Dim dcEmployee As New DataColumn With {
.ColumnName = "Employee",
.DataType = GetType(String)}
dtAttendanceTimes.Columns.Add(dcEmployee)
Dim dcDate As New DataColumn With {
.ColumnName = "Date",
.DataType = GetType(String)}
dtAttendanceTimes.Columns.Add(dcDate)
Dim dcClockIn As New DataColumn With {
.ColumnName = "Clock In",
.DataType = GetType(String)}
dtAttendanceTimes.Columns.Add(dcClockIn)
Dim dcClockType As New DataColumn With {
.ColumnName = "Type",
.DataType = GetType(String)}
dtAttendanceTimes.Columns.Add(dcClockType)
Dim dcApproved As New DataColumn With {
.ColumnName = "Approved",
.DataType = GetType(String)}
dtAttendanceTimes.Columns.Add(dcApproved)
For Each drAttendaceTime As DataRow In AttendancetimesAdaptor.GetDataByEmployeeID(intEmployeeID).Rows
dtAttendanceTimes.Rows.Add(drAttendaceTime("fkEmployee"), drAttendaceTime("strDate"), drAttendaceTime("strClockIn"), drAttendaceTime("strType"), drAttendaceTime("strApproved"))
Next
dgAttendanceTimes.ItemsSource = dtAttendanceTimes.DefaultView
そして、XAMLで私はそうのように私のデータグリッドを構築:私はそれを実行したときしかし、私はちょうど空白行を取得
<DataGrid x:Name="dgAttendanceTimes" AutoGenerateColumns="False" Style="{StaticResource MyDataGridStyle}" Grid.Column="1" Grid.Row="1" Grid.RowSpan="3">
<DataGrid.Columns>
<DataGridTextColumn Header="Employee" x:Name="Employee" Width="*" Binding="{Binding Path=Employee}"/>
<DataGridTextColumn Header="Date" x:Name="Date" Width="*" Binding="{Binding Path=Date}"/>
<DataGridTextColumn Header="Clock In" x:Name="ClockIn" Binding="{Binding Path=ClockIn}"/>
<DataGridTextColumn Header="Type" x:Name="Type" Visibility="Hidden" Binding="{Binding Path=Type}"/>
<DataGridTextColumn Header="Approved" x:Name="Approved" Binding="{Binding Path=Approved}"/>
</DataGrid.Columns>
</DataGrid>
を、私が手行数はすべて空白で列はありませんか?
何か助けていただければ幸いです。