【问题标题】:Xamarin Forms ListView ViewCell translationXamarin Forms ListView ViewCell 翻译
【发布时间】:2019-02-15 06:54:51
【问题描述】:

我的项目中有 2 个要翻译的资源文件。我在我的布局中使用了参数,它工作正常,但我有一个ListView,我需要从这个资源文件中绑定一个参数!

  <Label Text="Quantity" HorizontalTextAlignment="Center" TextColor="#231F20" FontFamily="{StaticResource MyriadProRegularFont}" Grid.Column="0" Grid.Row="0">
            <Label.FontSize>
                    <OnIdiom Phone="12" Tablet="14"/>
            </Label.FontSize>
   </Label>

这个标签放在ListView中,我需要将它绑定到资源文件中的一个参数。我该怎么做?

【问题讨论】:

    标签: listview xamarin.forms resources translation


    【解决方案1】:

    我通过在资源文件中将“访问修饰符”设置为公共来解决它

    并将标签绑定到参数:

     <Label Text="{x:Static controls2:LanguageResource.quantity}" HorizontalTextAlignment="Center" TextColor="#231F20" FontFamily="{StaticResource MyriadProRegularFont}" Grid.Column="0" Grid.Row="0">
                                                        <Label.FontSize>
                                                            <OnIdiom Phone="12" Tablet="14"/>
                                                        </Label.FontSize>
                                                    </Label>
    

    而且这个 xmlns 是放在 XAML 文件的顶部

     xmlns:controls2="clr-namespace:AppXamarin.Resources"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-20
      • 2020-02-10
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      相关资源
      最近更新 更多