【发布时间】:2012-05-18 21:26:44
【问题描述】:
我有一个带有组合框列的数据网格,它工作正常,但是否有可能获得 2 个显示成员?我想在框中显示前名和姓氏,但我只得到其中一个......
<WpfToolkit:DataGrid AutoGenerateColumns="false" EnableRowVirtualization="True" Height="226" ItemsSource="{Binding Source={StaticResource DataSet}, Path=PlacementsEmployees}" HorizontalAlignment="Left" Margin="739,57,0,0" Name="mitGrid" VerticalAlignment="Top" Width="Auto" DataContext="{Binding}" RowDetailsVisibilityMode="VisibleWhenSelected" IsSynchronizedWithCurrentItem="True" IsReadOnly="True" FontFamily="Verdana" FontSize="11">
<WpfToolkit:DataGrid.Columns>
<WpfToolkit:DataGridComboBoxColumn x:Name="test" Header="Employees" ItemsSource="{Binding Source={StaticResource DataSet}, Path=Employees}" SelectedValuePath="ID" SelectedValueBinding="{Binding Path=PE_Employees}" DisplayMemberPath="E_Surname" -> maybe "E_Forename; E_Surname" ?? <- IsReadOnly="True" />
</WpfToolkit:DataGrid.Columns>
</WpfToolkit:DataGrid>
我只想使用一列的原因是,我只想要一个标题(在我的情况下:员工) 你们看到我的问题了吗?也许数据模板有可能:)
【问题讨论】:
-
下拉菜单中现在显示什么?
-
没什么,它只是用来展示的,不是用来编辑的。只读 = true :)
-
您能否详细说明为什么要绑定到两个不同的对象 PlacementEmployees 和Employees?