Возникли проблемы с использованием шрифта. Работает нормально, когда я к следующему ниже.
FontFamily="{StaticResource IconFonts}" Text=""
Но это не работает, если я пытаюсь динамически привязать свойство текста.
FontFamily="{StaticResource IconFonts}" Text="{Binding Comments}"
Это показывает все странно. Похоже, он пытается что-то сделать, но не полностью рендерится. Вот полный код с моим тестированием, приведенным ниже. Заранее спасибо.
<FlexLayout x:Name="FlexFood"
Wrap="Wrap"
Direction="Row"
JustifyContent="Start"
Padding="0, 10"
BindableLayout.ItemsSource="{Binding FoodCollection}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<StackLayout Padding="5, 0">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="OnTypesSelected"></TapGestureRecognizer>
</Frame.GestureRecognizers>
<Frame.Content>
<StackLayout x:Name="LayoutFood">
<StackLayout VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
<Label x:Name="LabelTitle" Padding="0, 10">
<Label.FormattedText>
<FormattedString>
<Span FontSize="Subtitle" Text="{Binding Title}" FontAttributes="Bold"></Span>
<Span Text=" "></Span>
<Span FontSize="Subtitle" Text="{Binding Version}" FontAttributes="Bold"></Span>
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<StackLayout HorizontalOptions="StartAndExpand">
<Label Text="{Binding Description}" FontSize="Body"></Label>-->
<Label FontSize="Caption" TextColor="#LELELE">
<Label.FormattedText>
<FormattedString>
<Span Text="{Binding fDepartment}"></Span>
<Span Text="{Binding pType}"></Span>
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
<StackLayout HorizontalOptions="End">
<Label Text="{Binding Comments}"></Label>
<Label FontFamily="{StaticResource IconFonts}" Text=""></Label>
<Label x:Name="LabelTypeTest" FontFamily="{StaticResource IconFonts}"
Text="{Binding Comments, StringFormat=''}"></Label>
<Label FontFamily="{StaticResource IconFonts}" Text="{Binding Comments}"></Label>
<Image x:Name="ImageTypeTest">
<Image.Source>
<FontImageSource Size="48" FontFamily="{StaticResource IconFonts}" Color="#000000"></FontImageSource>
</Image.Source>
</Image>
</StackLayout>
</StackLayout>
</StackLayout>
</Frame.Content>
</helper:LayoutGradient>
</StackLayout>
</DataTemplate>
</BindableLayout.ItemTemplate>
</FlexLayout>
Вот ресурс stati c в приложении
<ResourceDictionary>
<OnPlatform x:Key="IconFonts" x:TypeArguments="x:String">
<On Platform="iOS" Value="Material Design Icons"></On>
<On Platform="Android" Value="IconFonts.ttf#Material Design Icons"></On>
<On Platform="UWP" Value="/Assets/IconFonts.ttf#Material Design Icons"></On>
</OnPlatform>
</ResourceDictionary>