Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Segoe UI Symbol font programmatically

I learn Windows Phone programming. Since I got Lumia 610 (WP7.8), I write in 7.1 SDK. The problem is I want my app to concatenate string with an arrow symbol, which is available in Segoe UI Symbol font. But when I try to force programme programmatically to use Segoe UI Font it doesn't work (it shows only a &#x 2708; string). When I'm forcing using for e.g. Comic Sans MS - there's no problem.

this.lExercise.Text = "zxcv";
                this.lExercise.Inlines.Add(new Run()
                {
                    Text = "✈",
                    FontFamily = new FontFamily("Segoe UI Symbol")                       
                });
                this.lExercise.Inlines.Add(new Run() { Text = " asdf", FontSize = 36 });

Any ideas appreciated :)

like image 857
kkoscielniak Avatar asked Jun 24 '13 20:06

kkoscielniak


2 Answers

The symbol for a right arrow is U+2192. The string you're using (✈) has been escaped so that it can be used in XAML. When using it in code, you use \u2192 to let it know that it's a symbol. So it should be

Text = "\u2192", //or \u2708 if you want the plane symbol
like image 143
keyboardP Avatar answered Oct 21 '22 17:10

keyboardP


You can use string content = '\u2708'.ToString();

like image 36
huuphongdn2009 Avatar answered Oct 21 '22 16:10

huuphongdn2009