Reputation: 4560
Is it possible to use a converter inside a DataGridComboBoxColumn.ElementStyle?
You can see below I have put The converter inside the Text Property, even though the converter class does run (I can debug it) the original text comes back. So What am I doing wrong?
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource"
Value="{Binding DataContext.Collection,
RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType=Window}}"/>
<Setter Property="DisplayMemberPath" Value="Id"/>
<Setter Property="HorizontalAlignment" Value="Center"</Setter>
<Setter Property="Text" Value="{Binding Id, Converter{StaticResource Converter}"></Setter>
</Style>
</DataGridComboBoxColumn.ElementStyle>
Thanks
Upvotes: 0
Views: 834
Reputation: 234
Is it not the case that the text may be being converted correctly but since the combobox itemsource is bound, the display text is using the ID field since the DisplayMemberPath is set and therefore the text property is being ignored.
Upvotes: 2