2017-05-04 46 views
0

我有一個Xamarin PCL Android/iOS/UWP項目。我使用Iconize FontAwsome圖標作爲應用程序。問題是,UWP dosent顯示任何圖標,但Android提供Xamarin Forms UWP,我如何使用Iconize和圖像

像這樣:

enter image description here 我的形式:

<?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 dosent支持圖標化?

  • Xam.Plugin.Iconize.FontAwsome
  • Xam.Plugin.Iconize
  • Xam.FormsPlugin.Iconize
  • FontAwsome.UWP
  • 中安裝的用於UWP的圖標化掘金

回答

1

這是一個已知的但沒有確認的問題,似乎並沒有在當前版本中修復。 GitHub Issue #13。我也遇到同樣的問題。

的解決方法,就是要做到這一點:

  • 在你的項目的根 創建一個文件夾Plugin.Iconize.Material.UWP \資產\ Fonts \中。
  • 將fontawesome.ttf複製到新目錄,並將 複製爲新的作爲其輸出。