0

正常に動作するコンボボックス列を持つデータグリッドがありますが、2 つの Displaymembers を取得することは可能ですか? ボックスに姓と名を表示したいのですが、そのうちの1つしか取得できません...

<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>

1 つの列だけを使用したい理由は、1 つのヘッダー (私の場合は従業員) だけが必要だからです。たぶん、データテンプレートの可能性があります:)

4

1 に答える 1

0

DisplayMemberPathDataTemplateプロパティを使用すると、バインドされたクラスのプロパティを 1 つだけ表示する場合にカスタムを作成できません。1 つのプロパティを表示する以上のものが必要な場合は、独自の を作成する必要がありますDataTemplate

于 2012-05-10T10:40:03.423 に答える