I have a series of objects representing some data point开发者_如何学编程s listed in a DataGridComboBoxColumn. Setting the DisplayMemeberPath property I can display a single value, say the x coordinate. What I would like to do though is display both the x and y coordinates in 'x, y' format. Any ideas on how to do this?
you should not use DisplayMemberPath, but instead use a DataTemplate, and a TemplateColumn
<ComboBox>
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding First}" Margin="0,0,10,0" />
<TextBlock Text="{Binding Second}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
精彩评论