mardi 14 février 2017

List of CheckBoxes Localization not working

I have the following control that uses Localization.

I have defined ResPropName in the English resource file as EnglishProperty and in the Spanish Resource file as SpanishProperty. Both properties are defined in the mySource.

Issue: When I try to switch languages, the Content of the checkboxes appears as SpanishProperty or EnglishProperty.

If I would replace the listbox with a combobox the language would switch and the proper text appears.

I have done the same test on one single check-box and I got the same issue.

   <UserControl x:Class="WpfApplication2.MainWindow" 
                 xmlns="http://ift.tt/o66D3f" 
                 xmlns:x="http://ift.tt/mPTqtT" 
                 xmlns:d="http://ift.tt/pHvyf2" 
                 xmlns:mc="http://ift.tt/pzd6Lm" 
                 xmlns:i="http://ift.tt/1hg9DTd" 
                 xmlns:local="clr-namespace:WpfApplication2" 
                 LocalizationScope.ResourceManager="{ResourceManager AssemblyName=WpfApplication2, BaseName=WpfApplication2.Resources.WpfApplication2Resources}"
                 mc:Ignorable="d" Height="350" Width="525">
        <Grid>

            <ListBox Name="listBox" ItemsSource="{Binding mySource}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <CheckBox Name="CheckBox" Content="{Loc ResPropName}">
                        </CheckBox>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

        </Grid>
    </UserControl>


    <ComboBox ItemsSource="{Binding mySource}" DisplayMemberPath="{Loc ResPropName}" /> 




Aucun commentaire:

Enregistrer un commentaire