0

我有一个 Xamarin PCL Android/iOS/UWP 项目。我为应用程序使用 Iconize FontAwsome 图标。问题是 UWP 不显示任何图标,但 Android 确实

像这样:

在此处输入图像描述 我的表格:

    <?xml version="1.0" encoding="utf-8" ?>
<controls:BasePage xmlns="http://xamarin.com/schemas/2014/forms"
                   xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                   xmlns:controls="clr-namespace:Volaapp.Controls;assembly:Volaapp"
                   xmlns:converters="clr-namespace:Volaapp.Converters;assembly:Volaapp"
                   xmlns:icons="clr-namespace:FormsPlugin.Iconize;assembly=FormsPlugin.Iconize"
                   xmlns:xlabs="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
                   x:Class="Volaapp.Pages.CreateTodoPage"
                   BackgroundColor="{StaticResource GrayColor}"
                   Title="Lisa uus võlg">
  <ScrollView BackgroundColor="{StaticResource WhiteColor}">
    <StackLayout Margin="10"
                 BackgroundColor="{StaticResource WhiteColor}">
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="65"/>
          <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition/>
          <RowDefinition Height="65"/>
          <RowDefinition Height="65"/>
          <RowDefinition Height="65"/>
          <RowDefinition Height="65"/>
          <RowDefinition/>
        </Grid.RowDefinitions>

        <!--Nimi ja Summa-->
        <StackLayout Grid.Column="0" Grid.Row="0"
                     BackgroundColor="{StaticResource MetroWhiteColor}"
                     VerticalOptions="FillAndExpand"
                     HorizontalOptions="FillAndExpand">
          <icons:IconImage VerticalOptions="CenterAndExpand"
                 HorizontalOptions="Center"
                 Icon="fa-gg"
                 IconColor="{StaticResource MetroBlackColor}"
                 HeightRequest="30"/>
        </StackLayout>
        <StackLayout Grid.Column="1" Grid.Row="0"
                     Orientation="Vertical"
                     BackgroundColor="{StaticResource MetroWhiteColor}"
                     HorizontalOptions="FillAndExpand"
                     VerticalOptions="FillAndExpand">
          <StackLayout Orientation="Vertical"
                       BackgroundColor="{StaticResource WhiteColor}"
                       HorizontalOptions="FillAndExpand"
                       VerticalOptions="FillAndExpand"
                       Margin="0,1,1,1">
            <Entry Text="{Binding Title}"
                   Placeholder="Sisesta pealkiri"
                   VerticalOptions="EndAndExpand"
                   Keyboard="Text"
                   Margin="15,0,15,2"/>
            <Entry 
                   VerticalOptions="EndAndExpand"
                   Placeholder="Sisesta Summa!"
                   Text="{Binding Loan}"
                   Keyboard="Numeric"
                   Margin="15,2,15,10"
          />
          </StackLayout>
        </StackLayout>

        <!--Inimesed-->
        <StackLayout Grid.Column="0" Grid.Row="1"
                     BackgroundColor="{StaticResource MetroWhiteColor}"
                     VerticalOptions="FillAndExpand"
                     HorizontalOptions="FillAndExpand">
          <icons:IconImage VerticalOptions="CenterAndExpand"
                 HorizontalOptions="Center"
                 Icon="fa-user"
                 IconColor="{StaticResource MetroBlackColor}"
                 HeightRequest="30"/>
        </StackLayout>
        <StackLayout Grid.Column="1" Grid.Row="1"
                     Orientation="Vertical"
                     BackgroundColor="{StaticResource MetroWhiteColor}"
                     HorizontalOptions="FillAndExpand"
                     VerticalOptions="FillAndExpand">
          <StackLayout Orientation="Vertical"
                       BackgroundColor="{StaticResource WhiteColor}"
                       HorizontalOptions="FillAndExpand"
                       VerticalOptions="FillAndExpand"
                       Margin="0,1,1,1">
            <controls:BindablePicker Margin="20,5"
                                     ItemsSource="{Binding Tags}"
                                     SelectedItem="{Binding SelectedTag, Mode=TwoWay}"
                                     DisplayMemberPath="Title"
                                     Title="Vali inimene"
                                     VerticalOptions="EndAndExpand"/>
          </StackLayout>
        </StackLayout>

        <!--Rahatäht-->
        <StackLayout Grid.Column="0" Grid.Row="2"
                     BackgroundColor="{StaticResource MetroWhiteColor}"
                     VerticalOptions="FillAndExpand"
                     HorizontalOptions="FillAndExpand">
          <icons:IconImage VerticalOptions="CenterAndExpand"
                 HorizontalOptions="Center"
                 Icon="fa-money"
                 IconColor="{StaticResource MetroBlackColor}"
                 HeightRequest="30"/>
        </StackLayout>
        <StackLayout Grid.Column="1" Grid.Row="2"
                     Orientation="Vertical"
                     BackgroundColor="{StaticResource MetroWhiteColor}"
                     HorizontalOptions="FillAndExpand"
                     VerticalOptions="FillAndExpand">
          <StackLayout Orientation="Vertical"
                       BackgroundColor="{StaticResource WhiteColor}"
                       HorizontalOptions="FillAndExpand"
                       VerticalOptions="FillAndExpand"
                       Margin="0,1,1,1">
            <controls:BindablePicker Margin="20,5"
                                     ItemsSource="{Binding CurrencyList}"
                                     SelectedItem="{Binding Currency, Mode=TwoWay}"
                                     Title="Vali Rahatäht"
                                     VerticalOptions="EndAndExpand"/>
          </StackLayout>
        </StackLayout>

        <!--Due date-->
        <StackLayout Grid.Column="0" Grid.Row="3"
                     Orientation="Vertical"
                     BackgroundColor="{StaticResource MetroWhiteColor}"
                     VerticalOptions="FillAndExpand"
                     HorizontalOptions="FillAndExpand">

          <xlabs:ImageButton Image="_duedate.png"
                   ImageHeightRequest="35"
                   ImageWidthRequest="35"
                   BackgroundColor="{StaticResource MetroWhiteColor}"
                   VerticalOptions="CenterAndExpand"
                   HorizontalOptions="Center"
                   BorderRadius="0"
                   Command="{Binding SelectDueDateCommand}"/>
        </StackLayout>
        <StackLayout Grid.Column="1" Grid.Row="3"
                     BackgroundColor="{StaticResource MetroWhiteColor}"
                     HorizontalOptions="FillAndExpand"
                     VerticalOptions="FillAndExpand">
          <StackLayout BackgroundColor="{StaticResource WhiteColor}"
                       HorizontalOptions="FillAndExpand"
                       VerticalOptions="FillAndExpand"
                       Margin="0,1,1,1">
            <Label Text="{Binding DueTime, StringFormat='Kuupäev  {0:dd.MM.yyyy HH:mm}'}"
                   FontSize="17"
                   Margin="25,0"
                   TextColor="{StaticResource BlackColor}"
                   VerticalTextAlignment="Start"
                   VerticalOptions="CenterAndExpand"
                   HorizontalOptions="StartAndExpand">
            </Label>
          </StackLayout>
        </StackLayout>

        <!--Meeldetuletus-->
        <StackLayout Grid.Column="0" Grid.Row="4"
                     Orientation="Vertical"
                     BackgroundColor="{StaticResource MetroWhiteColor}"
                     VerticalOptions="FillAndExpand"
                     HorizontalOptions="FillAndExpand">
          <Image HeightRequest="35"
                 WidthRequest="35"
                 Source="{Binding ReminderIcon}"
                 VerticalOptions="CenterAndExpand"
                 HorizontalOptions="CenterAndExpand">
          </Image>


        </StackLayout>
        <StackLayout Grid.Column="1" Grid.Row="4"
                     BackgroundColor="{StaticResource MetroWhiteColor}"
                     HorizontalOptions="FillAndExpand"
                     VerticalOptions="FillAndExpand">
          <StackLayout BackgroundColor="{StaticResource WhiteColor}"
                       Orientation="Horizontal"
                       HorizontalOptions="FillAndExpand"
                       VerticalOptions="FillAndExpand"
                       Margin="0,1,1,1">
            <Label Text="Meeldetuletus"
                   FontSize="17"
                   Margin="25,0,0,0"
                   TextColor="{StaticResource BlackColor}"
                   VerticalTextAlignment="Start"
                   VerticalOptions="CenterAndExpand"
                   HorizontalOptions="Start"/>
            <Switch IsToggled="{Binding EnableReminder, Mode=TwoWay}"
                    VerticalOptions="CenterAndExpand"
                    HorizontalOptions="Start"
                    Margin="20,0"/>
          </StackLayout>
        </StackLayout>

        <!--Button-->
        <StackLayout Grid.Column="1" Grid.Row="5"
                   Orientation="Horizontal" Margin="0,30"
                   HorizontalOptions="EndAndExpand"
                   VerticalOptions="CenterAndExpand">
          <xlabs:ImageButton
                             BackgroundColor="{StaticResource MetroWhiteColor}"
                             Text="SAVE" FontSize="12"
                             IsEnabled="{Binding IsValid}"
                             HorizontalOptions="StartAndExpand"
                             HeightRequest="40"
                             WidthRequest="100"
                             BorderRadius="0"
                             Command="{Binding SaveCommand}"/>
          <xlabs:ImageButton
                           BackgroundColor="{StaticResource MetroWhiteColor}"
                           Text="CANCEL"
                           HorizontalOptions="StartAndExpand"
                           BorderRadius="0"
                           HeightRequest="40"
                           WidthRequest="100"
                           FontSize="12"
                           Command="{Binding CancelCommand}"/>
        </StackLayout>
      </Grid>
    </StackLayout>
  </ScrollView>
</controls:BasePage>

我是否缺少金块或 UWP 剂量支持图标化?

在 UWP 中安装的用于 iconize 的块:

  • Xam.Plugin.Iconize.FontAwsome
  • Xam.Plugin.Iconize
  • Xam.FormsPlugin.Iconize
  • FontAwsome.UWP
4

1 回答 1

1

这是一个已知但尚未确认的问题,并且似乎在当前版本中没有得到修复。GitHub 问题 #13。我也遇到同样的问题。

解决方法是这样做:

  • 在项目的根目录中创建一个文件夹 Plugin.Iconize.Material.UWP\Assets\Fonts\。
  • 将 fontawesome.ttf 复制到新目录并设置为 Copy if newer 作为其输出。
于 2017-05-05T05:54:29.717 回答