Windows Store Apps: Change the icon of an AppBar Button? - windows-8

I want to change the icon of an AppBar Button in my Windows Store app.
I found that the AppBar buttons have XAML markup that looks like this:
<Style x:Key="PicturesAppBarButtonStyle"
TargetType="ButtonBase"
BasedOn="{StaticResource AppBarButtonStyle}">
<Setter Property="AutomationProperties.AutomationId"
Value="PicturesAppBarButton"/>
<Setter Property="AutomationProperties.Name"
Value="Pictures"/>
<Setter Property="Content" Value=""/>
</Style>
What does the content value  mean? Is there any refernece to the built-in icons ?
Also how can I display a different icon of my own ?

The Content is the Unicode character number for the used font "Segoe UI Symbol" .
See a list of symbols in
LIST OF BUTTON SYMBOLS

You can use CharacterMap to pick icons other than defined in StandardStyles.xaml. The character map gives you the hex code which you can then use in button style. There are tonnes of symbols in Segoe UI Symbol.
In case of if you want to use Image or Path, then you have to re-edit some visual states in the style.

The hex value  is a symbol in the Segoe UI font. This is the symbol shown in the center of the button.
I've written a blog post on how to create your own app bar button that includes a reference of Segoe UI symbols you can use, along with their hex values.

Related

Embedded font doesn't recognize bold

How can i reference a embbed font in my silverlight project, considering that there are multiple files for the same font?
I used the following tags in a Fonts.xaml file:
<FontFamily x:Key="MyFamily">../../Resources/Fonts/segoeui.ttf#Segoe UI</FontFamily>
In another file I have a tag to link this fontfamily to any TextBlock.
When I have a simple TextBlock it works fine:
<TextBlock Text="Simple" />
But when i want a bold text, it is not working;
<TextBlock Text="Simple" Font-Weight="Bold" />
I Know that the bold font is in another file (segoeuib.ttf), but since I refer to a specific file, and not the font name, its not finding. How can i refer to both file, without having to add FontFamily tag to all my TextBlock that needs to display Bold text?
PS: If I use the Font family name, without the file name, it will work, but if my user doesn't have the font in his/her computer it wont work.
I discovered how to do it, sharing in case someone has the same problems.
Instead of referring to the .ttf file, just put all font files in a zip and refer to the zip:
<FontFamily x:Key="MyFamily">../../Resources/Fonts/SegoeUI.zip#Segoe UI</FontFamily>

Can not display tooltip when mouse is over text on PDF

I need some way to have like a tooltip when the mouse is over text. I mean, something like <block>Some text</block> and when the mouse is over "Some text" y need to display a tooltip, just like an HTML link that when the mouse is over it, a tooltip with the value of the title attribute is displayed.
I've searched so much and could not find the answer to my problem.
Annotations in PDF are not part of the XSL FO Specification. The only product I am aware of that supports such things is RenderX's XEP engine. You can review the documentation on this feature here:
http://www.renderx.com/reference.html#PDF%20Note%20Annotations
One would use:
<fo:block>Note here<rx:pdf-comment content="This is the text of a popup comment"/> and some text after</fo:block>
rx:pdf-comment has additional attributes to set the title of the annotation, the color of the annotation and the opacity it displays with. You can also change the icon used in the PDF.

RichTextBlock, Paragraph, Hyperlink... and globalization

In Windows Phone 8.1 you can use different languages useing the property "x:Uid" of an element, if I do
<textblock x:Uid="string1"/>
and in a resource file I write
string1.Text: sentence in english
then "sentence in english" "is written" in the Text property of the textblock. For buttons would be string1.Content.
But I have a problem, I am using RichTextBlock, with a Paragraph and Hyperlink inside, I can use x:Uid but... which property to use? They don't have Text or Content property, so... how can I globalizate that elements?
Thank you.
The Paragraph and Hyperlink are collections. The actual text comes from a Run somewhere inside, and the Run has a Text property. If you set the run explicitly instead of implicitly then you can add x:Uid to its Text property:
Xaml:
<Hyperlink>
<Run x:Uid="hlink" Text="http://microsoft.com" />
</Hyperlink>
Resources.resw:
<data name="hlink.Text" xml:space="preserve">
<value>http://stackoverflow.com</value>
</data>
The displayed Hyperlink will pull the stackoverflow URL from the resource file.

Using Segoe WP Light in Windows Phone 8.1 apps

Is it possible to use Segoe WP Light in Windows Phone 8.1 applications? I would like to use the font in a pivot title, but it doesn't work. I can use SemiLight but not Light. Any ideas why?
<DataTemplate x:Key="PivotTitleTemplate">
<TextBlock
Margin="-1,0,0,0"
FontFamily="Segoe WP Light"
FontSize="20"
Text="{Binding}" />
</DataTemplate>
I have found a solution to this problem.
To use Segoe WP Light, set the font family to Segoe WP and its weight to light. To use Segoe WP SemiLight, set the font family to Sego WP SemiLight and its weight to normal.
For some reason, Visual Studio does not render the fonts properly. Sometimes, it's possible to get the fonts rendered properly if you use the properties windows to set them. However, this only works until you modify any code or switch tabs. Fortunately, on a real device, all fonts are rendered properly.

Custom Font in Windows Phone 8

I tried to add a custom font into my application. I need it for the page title. I copied the font to a folder named "Fonts" and changed the build action to Content. In the property panel the font shows up in the font list. But when i add the font the page title doesn't change. It changes a little bit but not like the font i'm using. The odd thing is when i double click on the page title the text gets highlighted in the textblock and then the highlighted text shows in the font i want. This is confusing. What should i do to correct this?
XAML for the page title
<TextBlock Text="page title" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontFamily="/AppName;component/Assets/Fonts/Dekers_Bold.ttf#Dekers_Bold" />
You have to add fonts as BlendEmbeddableFonts
Open your solution in blend, go to the font manager and in "Embedded Fonts", check your custom font.
Then create a resource called
<FontFamily
x:Key="CustomFont">/Wake Jake;component/Fonts/Fonts.zip#FontName</FontFamily>
and add it as
FontFamily="{StaticResource CustomFont}"
It will work that way.
Let me know if you need further help
If the font is located in your main WP8 project, you don't need to use the /AppName;component path. Also make sure the Dekers_Bold is actually name of the font, you should maybe try DekersBold or just Dekers:
FontFamily="/Assets/Fonts/Dekers_Bold.ttf#DekersBold"
If this is not working, try to add your font as resources first:
<FontFamily x:Key="Dekers">/Assets/Fonts/Dekers_Bold.ttf#DekersBold</FontFamily>
...
<TextBlock Text="page title" Margin="9,-7,0,0" FontFamily="{StaticResource Dekers}" />
Any Font works in windows 8, but after you add it to your project, right click on the font, choose properties and set "Build action" to "Content". Have a great day!
Unfortunately not all fonts work with Windows Phone 8. It tried your font (donwloaded from dafont) in a WP 7.1 project as described here and it works perfectly. Doing the same in a WP 8 project... the font won't load. So, you probably have to pick another font.