Xamarin Form FormattedText对Android不可绑定,对于iOS可以正常工作

时间:2018-09-16 06:47:51

标签: string xamarin xamarin.forms

我有与Xamarin格式的FormattedText绑定有关的问题     参见下面的代码参考

<Label HeightRequest="40" FormattedText="{Binding CustomContent}"  Style="{StaticResource SmallTextStyle}"  TextColor="{StaticResource FadedTextColor}" HorizontalOptions="StartAndExpand" VerticalOptions="Center" LineBreakMode="TailTruncation"/>




ViewModel--

    public class CustomerViewModel : BaseViewModel
{
   private FormattedString _customContent;
        public FormattedString CustomContent
        {
            get { return _customContent; }
            set { SetProperty(ref _customContent, value); }
        }
    public CustomerViewModel()
{
CustomContent = new FormattedString
                {
                    Spans =
                    {
                        new Span { Text = "Text1", FontSize=14 },
                        new Span { Text = "Test2 ", FontSize=12, },
                        new Span { Text = "Test3",  FontSize=12, },
                    }
                };
}

}

可以请大家建议正确的答案

0 个答案:

没有答案