画面デザイン中はアイコンフォントが表示されるのですが、ビルド後画面表示を行うと反映されません。(画像1参照) どなたか解決方法ご存じないでしょうか。
[画像1]
■やったこと
1.NuGetで”FontAwesome (ver 4.7.0)をインストール (画像2参照)
[画像2]
2.App.xamlに<FontFamily>を追加
<Application x:Class="WpfApplication1.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication1" StartupUri="MainWindow.xaml"> <Application.Resources> <FontFamily x:Key="FontAwesome">/Fonts/fontawesome-webfont.ttf#FontAwesome</FontFamily> </Application.Resources> </Application>
3.MainWindow.xamlに<Button>追加
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApplication1" mc:Ignorable="d" Title="MainWindow" Height="768" Width="1366" FontFamily="/WpfApplication1;component/fonts/#FontAwesome"> <Grid> <Button x:Name="button_on" Content="検索" FontFamily="{DynamicResource FontAwesome}" HorizontalAlignment="Left" Margin="44,22,0,0" VerticalAlignment="Top" Height="28" Width="100"/> <Button x:Name="button_off" Content="検索" FontFamily="{DynamicResource FontAwesome}" HorizontalAlignment="Left" Margin="150,22,0,0" VerticalAlignment="Top" Height="28" Width="100" IsEnabled="False"/> </Grid> </Window>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/06/19 06:00