While developing my app in WPF i used that code for localizing:
<DataGridTextColumn Header="{x:Static p:Resources.DwApplicationId}" Binding="{Binding Id}"/>
Now i try to upgrade the app to WinUI3, and there are no "x:Static" allowed. Also i have to use another way (Windows.ApplicationModel.Resources.ResourceLoader) to get the strings.
I googled for hours, but nothing found. Maybe anyone knows how to fix it?
CodePudding user response:
Try to set the Header
to a localized TextBlock
:
<DataGridTextColumn Binding="{Binding Id}">
<DataGridTextColumn.Header>
<TextBlock x:Uid="DwApplicationId"/>
</DataGridTextColumn.Header>
</DataGridTextColumn>
Or set the Header
property programmatically:
col.Header = ResourceLoader.GetForCurrentView().GetString("DwApplicationId");