So i wanted to use a costum font on my uwp app, i download the font from google fonts then added to the folder Fonts the file as been set as content and the file gets copied on the output directory everytime which i guess is the app package?
<StackPanel>
<TextBlock Text="Cantami Diva" FontSize="72"/>
<TextBlock Text="Cantami Diva" FontSize="72" FontFamily="ms-appx:///Assets/Fonts/Arvo-Regular.tff#Arvo"/>
</StackPanel>
here is the problem, the second textblock where the font is applied is getting displayed the same as the first, i guess it cant find the font, but if i install the font on my computer it works perfectly, is there no way to use the font without having the user to install it?
The True Type Font extension is .TTF not .TFF
I did a quick test and after changing the typo you had it worked fine for me.
<StackPanel>
<TextBlock Text="Cantami Diva" FontSize="24"/>
<TextBlock Text="Cantami Diva" FontSize="24" FontFamily="ms-appx:///Assets/Fonts/Arvo-Regular.ttf#Arvo"/>
</StackPanel>
Related
so i have a button whos XAML is as follows:
<Grid>
<!--MoreCode -->
<Button x:Name="Camera2" Grid.Column="2" Grid.Row="7">
<Grid>
<Image Source="images\tabNormal.png"></Image>
<Image Source="images\OfflineRed_21x76.png" Height="18"
VerticalAlignment="Bottom" Margin="0,0,0,5"></Image>
<TextBlock HorizontalAlignment="Center" Text="Camera 2"
VerticalAlignment="Center"/>
</Grid>
</Button>
<!--MoreCode -->
</Grid>
and it Previews ok.
But when i Run the project I get this:
In the end I will end up making this button a standard control, but i want to understand why it does not seem to build right when I run.
in Closing, the problem seemed to be something with the compiler not referencing the images properly (perhaps because I added the images folder to the project after building everything?), the solution was to add the full path to the images i.e. C:\...folders...\images\filename.png as opposed to the initial images\filename.png once this was done once for one file all files in that folder are readable and you can return to a relitive location. Everything seems to be working fine now even after deleting and re adding the files/folder
I need to use a pixel font "8bitoperator_jve" in label in WPF from https://ru.fonts2u.com/8bitoperator-jve-regular.%D1%88%D1%80%D0%B8%D1%84%D1%82. I've downloaded .ttf file with font and put it to Resources, set 'Resource' in Build Action and tried the following code:
<Label FontFamily="./#8bitoperator_jve" FontSize="100" Foreground="White"> Check </Label>
It wouldn't work. How can I fix it?
I suggest you use it directly after installation
this.label1.FontFamily = new FontFamily("8bitoperator JVE Regular");
You are inserting an incorrect font name. You must enter the actual font name, not the filename. Open the font and copy the Font name. Try this:
<Label FontFamily="./#8bitoperator JVE" FontSize="100" Foreground="White"> Check </Label>
I'm not sure if ./ is correct, if the code above won't work, try to remove this and leave just #8bitoperator JVE
I tried to add google font to my silverlight project. so i downloaded the zip and added the fonts to Fonts folder:
I tried to load it like this:
<controls:DynamicTextBlock Grid.Column="2"
Width="200"
HorizontalAlignment="Left"
FontSize="{StaticResource FontSize6}"
FontFamily="/EZTrader;Component/Fonts/#RobotoLight"
Foreground="White"
Text="{Binding UserFullName}"
ToolTipService.ToolTip="{Binding UserFullName}" />
and nothing happened.
what should i do to fix this?
thanks!
If you are using windows, Open the font you want to use with Windows Font Viewer
Check the Font name:. That name is what you will use when referencing it. Note: the font name may not always match the filename of the .ttf and can also include spaces.
You want to make sure that the `Build Action' of the included file in the project is set to Resource as you want to be able to reference it from xaml.
You can create a static resource for the FontFamily in your App.xaml so you can reference it throughout your project.
Assuming the name of the assembly for your project is EzTrader.dll
<FontFamily x:Key="RobotoLightFontFamily">/EzTrader;component/Fonts/RobotoLight.ttf#[Font name here]</FontFamily>
<FontFamily x:Key="RobotoThinFontFamily">/EzTrader;component/Fonts/Roboto-Thin.ttf#[Font name here]</FontFamily>
<!-- other font resources -->
Then build the project.
From there you should be able to reference it like so
<controls:DynamicTextBlock Grid.Column="2"
Width="200"
HorizontalAlignment="Left"
FontSize="{StaticResource FontSize6}"
FontFamily="{StaticResource RobotoLightFontFamily}"
Foreground="White"
Text="{Binding UserFullName}"
ToolTipService.ToolTip="{Binding UserFullName}" />
Reference:
How to use your own fonts within Silverlight
Using Custom Fonts in Silverlight
Using built-in, embedded and streamed fonts in Silverlight
If you can, check what the display name of the font is, instead of the file name for the part after the #. It may actually be Roboto Light.
<controls:DynamicTextBlock FontFamily="/EZTrader;component/Fonts/RobotoLight.ttf#Roboto Light" />
You may also need to change the build properties on your font file as seen here: http://geekswithblogs.net/mamta_m/archive/2010/07/01/adding-custom-fonts-to-your-silverlight-application.aspx.
Any one knows how to show the slider tool tip on Windows Phone 8.1 WinRT? I have checked the property IsThumbToolTipEnabled but no tool tip is shown. I couldn't find any resources on how to do this on phone. Any clue?
Set a custom template and use the tooltipservice api.
First, edit the style for a slider. Next find the <Thumb> Element. This code will work and show the text, and you can use binding for the text value.
<Thumb>
<ToolTipService.ToolTip>
<TextBlock Text="Your text"/>
</ToolTipService.ToolTip>
</Thumb>
I'm having a problem with the listpicker (SelectionMode="Multiple"!!!). When i go to fullmode it doesnt show "done", "cancel" icons like if the images were not in my project.
On full screen mode i only have this xaml code
<DataTemplate x:Key="listPickerFullModeItemTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" FontSize="30" Height="40" FontFamily="Segoe WP"/>
</StackPanel>
</DataTemplate>
<toolkit:ListPicker Header="Floral" SelectionMode="Multiple" FullModeHeader="Floral" CacheMode="BitmapCache" x:Name="floralListPicker" Margin="0,0,12,0" ItemTemplate="{StaticResource listPickerItemTemplate}" FullModeItemTemplate="{StaticResource listPickerFullModeItemTemplate}"/>
Code is ok, everything works fine but the icons doesn't show, actually it shows as the default app bar missing icon image. I copied the images from toolkit sample but no go.
anyone know whats wrong?
anyway to force icons on template?
thanks.
Do you need to set the Build Action of the icons to "Content" in their properties window?
I found out the solution by exploring the sample solution of the toolkit.
If you don't use a special page for the fullmode selection, you need to include the following images to your project:
Create one subfolder named Toolkit.Content (not ToolKit/Content).
Then, include the files named as this : ApplicationBar.Cancel.png and ApplicationBar.Check.png.
Mark them to be generated as content.
That's all! Your icons should now been displayed.
Hope this helps you !