0
私はカスタムのユーザーコントロールを使用して、アプリケーションでFontAwesomeフォントを使用していて、正しく動作します。Xamarinフォーム - カスタムUserControlでResourceDictionaryスタイルを使用する
App.xamlのResourceDictionaryでStyleを使用してコントロールのスタイルを設定したいとします。スタイルを利用
ページは次のとおりです。
<StackLayout x:Name="TopStack">
<Grid VerticalOptions="FillAndExpand" BackgroundColor="#012c50" HeightRequest="200">
<Image Source="{local:ImageResource AAAApp.Images.navbartop.png}" Aspect="AspectFill" />
<userControls:FontAwesomeLabel Text="{x:Static userControls:Icon.FAUserCircle}" Style="{StaticResource SideMenuNameIcon}" />
<userControls:FontAwesomeLabel Text="{x:Static userControls:Icon.FAChevronRight}" />
<Label Text="Name Here" Style="{StaticResource SideMenuName}" />
<Label Text="1234567891231" Style="{StaticResource SideMenuAccount}" />
</Grid>
</StackLayout>
スタイルは、通常のラベルに正しく動作することに注意してください - 緑の矢印。
私はアプリケーションを実行すると、私は次のエラーを取得する:
だから私は問題はなスタイルでのTargetTypeである把握。
しかし、私が試してみました:
- TargetTypeに= "ラベル">
- TargetTypeに= "Label.FontFamily"
- TargetTypeに= "のfontFamily">
- TargetTypeに= "のUserControlを:FontAwesomeLabel ">
- TargetTypeが=" のUserControl ">
- TargetTypeに=" FontAwesomeLabel ">
同じ結果が表示されます。
私は何をしないのですか?
ありがとうございます!