View previous topic :: View next topic |
Author |
Message |
waltersb
Joined: 12 Jun 2012 Posts: 5
|
Posted: Thu Jul 05, 2012 8:19 am Post subject: Resource name is displayed instead of the resource text |
|
|
I have the following Problem:
I use the datagrid from WPFToolkit
Code: |
<Window ResxExtension.DefaultResxName="Lokalisierungstest.MainWindow"
Language="{UICulture}"
x:Uid="Window_1"
x:Class="Lokalisierungstest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
Title="{Resx Window_Title}"
Height="350"
Width="525"
WindowStartupLocation="CenterScreen">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="35" />
</Grid.RowDefinitions>
<dg:DataGrid Grid.Row="1">
<dg:DataGrid.Columns>
<dg:DataGridTextColumn Header="{Resx dg:DataGridTextColumn_Header1}" />
<dg:DataGridTextColumn Header="{Resx dg:DataGridTextColumn_Header2}" />
<dg:DataGridTextColumn Header="{Resx dg:DataGridTextColumn_Header3}" />
</dg:DataGrid.Columns>
</dg:DataGrid>
</Grid>
</Window>
|
Globalizer detected the header attribut in the DataGridTextColumns correctly and replaced the text by "{Resx...}"
Unfortunately when I start the application the headers of the data grid looks like this:
#dg:DataGridTextColumn_Header1 | #dg:DataGridTextColumn_Header2 | dg:DataGridTextColumn_Header3
It seems that the resources are not found and therefore the resource names are displayed.
But the xxx.resources.dll exists and all other texts are displayed correctly. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Jul 05, 2012 11:03 pm Post subject: |
|
|
If the DataGridTextColumn objects are not implemented as DependencyObjects then you may need to set the ResxName property for these elements explicitly (rather than relying on the DefaultResxName set for the Window) ie
Code: | <dg:DataGridTextColumn Header="{Resx ResxName= =Lokalisierungstest.MainWindow, Key=dg:DataGridTextColumn_Header1}" /> |
In the Globalizer XAML settings you can create a special "Scan and Convert Properties" rule for this Control Type and set the "Set ResxName" property so that if you have other instances of the same control this is done automatically when they are converted to use Resx. _________________ Infralution Support |
|
Back to top |
|
|
gunters63
Joined: 25 Jan 2011 Posts: 21
|
Posted: Wed Aug 08, 2012 3:20 pm Post subject: |
|
|
I have the same problem with GridViewColumn Header.
Code: | <GridViewColumn Header="{Resx ResxName=SonicTC.View.Workflow.Views.VersionablesView, Key=GridViewColumn_Header9}"
DisplayMemberBinding="{Binding CreationUser, Mode=OneWay}"
behaviors:GridViewColumnResize.Width="Auto" /> |
works
Code: | <GridViewColumn Header="{Resx Key=GridViewColumn_Header9}"
DisplayMemberBinding="{Binding CreationUser, Mode=OneWay}"
behaviors:GridViewColumnResize.Width="Auto" /> |
with ResxExtension.DefaultResxName set does not.
But GridViewColumn derives from DependencyObject.
GridViewColumn isn't part of the visual tree, so you normally cannot use Binding (although there are tricks to make it work), even though the Header property is a DependencyProperty. If the Resx markup extension uses data binding internally thats probably the problem. |
|
Back to top |
|
|
|