This project is read-only.

Localization Not Formated

Feb 7, 2012 at 9:50 AM

While Localizing the ListItem Controls I am getting issue on build.

Considered the below code:



 <src:ProductCategory>Computers</src:ProductCategory >

After i run the WPF addIn using static resource method , the modified content is as below

<src:ProductCategory><Static Member="lex:AddProductWindow.Books" xmlns="" /></src:ProductCategory>






<src:ProductCategory><Static Member="lex:AddProductWindow.Computers" xmlns="" /></src:ProductCategory>

while building i get the following error

The type 'ProductCategory' does not support direct content.

How to resolve these type of control content for localization....?

Feb 7, 2012 at 12:11 PM

How ProductCategory type is defined?

And please provide little more XAML to see how you put it inside ListItemControl.

Perhaps you'll need to adjust ProductCategory type definition in order to localize it using this approach.

E.g. perhaps use of xaml attribute instead of element content will help?

Feb 7, 2012 at 12:51 PM

ProductCategory is the enum class.. which i have defined,

add placeing the content for enum tag.

ok even though i used <ListItem> intead of i can use it.

Feb 7, 2012 at 2:28 PM

Ok, since it is enum, you must leave these values not localized (<src:ProductCategory>Computers</src:ProductCategory >). 

But when enum values are displayed by WPF, you can e.g. use custom template/converter to provide localization.

E.g. with ComboBox:

    <DataTemplate x:Key="EnumItemTemplate">

        <TextBlock Text="{Binding Converter={StaticResource EnumLocalizationConverter}}"/>


    <ComboBox ... ItemTemplate="{StaticResource EnumItemTemplate}">

Where EnumLocalizationConverter converts enum values to strings using resx files.