<DataGrid Name="datagrid" IsReadOnly="True" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="姓名" Width="100" Binding="{Binding Name}"></DataGridTextColumn>
<DataGridTextColumn Header="工号" Width="100" Binding="{Binding Number}"></DataGridTextColumn>
<DataGridTextColumn Header="入职时间" Width="100" Binding="{Binding InDate}"></DataGridTextColumn>
<DataGridComboBoxColumn Header="学历" Width="80" SelectedValueBinding="{Binding EducationId}" SelectedValuePath="Id"
DisplayMemberPath="Name" x:Name="columnEducationId"></DataGridComboBoxColumn>
<DataGridTextColumn Header="毕业院校" Width="100" Binding="{Binding School}"></DataGridTextColumn>
<DataGridTextColumn Header="基本工资" Binding="{Binding BaseSalary}"></DataGridTextColumn>
<DataGridComboBoxColumn Header="部门" Width="100" SelectedValueBinding="{Binding DepartmentId}" SelectedValuePath="Id"
DisplayMemberPath="Name" x:Name="columnDepartmentId"></DataGridComboBoxColumn>
<DataGridTextColumn Header="职位" Width="100" Binding="{Binding Position}"></DataGridTextColumn>
<DataGridTextColumn Header="合同签订日" Width="100" Binding="{Binding ContractStartDay}"></DataGridTextColumn>
<DataGridTextColumn Header="合同到期日" Width="100" Binding="{Binding ContractEndDay}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
视频第五季中员工管理界面的代码。
问题一:<DataGridTextColumn>和<DataGridComboBoxColumn>这个“部门”项我真的想用<DataGridTextColumn>,为什么要用
<DataGridComboBoxColumn>呢?因为我只显示文本,
问题二:我的程序运行后有的列没有绑定上,但我确实给它数据源了呀?
|
-
q.JPG
(19.41 KB, 下载次数: 38)
|