<DataGrid IsEnabled="False" ItemsSource="{Binding OpInqueryLine}" x:Name="OperatorWork" CanUserAddRows="False" HorizontalAlignment="Left" Height="312" Margin="47,106,0,0" VerticalAlignment="Top" Width="629">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding managerID}" Header="卡号" Width="160"/>
<DataGridTextColumn Binding="{Binding cardName}" Header="用户名" Width="160"/>
<DataGridTextColumn Binding="{Binding loginTime}" Header="上班时间" Width="160"/>
<DataGridTextColumn Binding="{Binding logoutTime}" Header="下班时间" Width="160"/>
</DataGrid.Columns>
</DataGrid>
上图中是绑定数据库中某一个表的列名。
如果有分页的话绑定,分页中的数据源