-
Hi, I didn't understand how I can use localization in a DataGridComboBoxColumn. I have an Enum, for example:
ObjectDataProvider:
The DataGridComboBoxColumn:
"diverse" is an int value from database. "None", "One", "Two" should be translated into the desired language. |
Beta Was this translation helpful? Give feedback.
Answered by
Karnah
Dec 21, 2022
Replies: 1 comment
-
Hello, @itarci. <DataGridComboBoxColumn Header="{lex:Loc DiagonalLift}" Width="Auto"
SelectedItemBinding="{Binding diverse, Converter={StaticResource EnumConverter}, ConverterParameter={x:Type local:enum_DiagonalLift}}}">
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding Source={StaticResource myEnum_DiagonalLift}, Mode=OneWay}" />
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{lex:Loc {Binding }}" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="ComboBox">
<Setter Property="ItemsSource" Value="{Binding Source={StaticResource myEnum_DiagonalLift}, Mode=OneWay}" />
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{lex:Loc {Binding }}" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
</DataGridComboBoxColumn> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
konne
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, @itarci.
I don't have much experience in working with
DataGrid
andObjectDataProvider
. But I found a solution with overloading default styles. Does it suit you?