Monospaced TextBlock using Segoe WP font

Go To StackoverFlow.com

3

I have a numerical value that ranges from 100-500 that changes every second or so. Because numerical characters for Segoe WP are variable widths, the text jumps when it changes.

Using the Segoe WP font in a XAML file; Is there a way to make numerical (or any) text render with monospaced (fixed width) characters?

2012-04-05 19:03
by tidwall
Not sure what you mean by "jump" but if you mean other content placement changes because the width of your numeric value changes, is it something you could just wrap in a parent element with a fixed width so the width of the numbers cant interact with other objects? Like, Chris W. 2012-04-05 20:17
By jump, I mean that TextBlock.ActualWidth width of the value "100" is different than the TextBlock.ActualWidth of "499". So when the value switches, so does the horizontal alignment - tidwall 2012-04-05 23:19
Can't you just RightAlign the text and set the width to something you know is bigger than required - Paul Marques 2012-05-14 12:51


6

A work around is to use the "Segoe UI" font family instead, which has monospaced numbers, and is reasonably similar.

2012-11-25 00:27
by Eric
From \u3905 to \u391 - Mohamed Mansour 2016-09-11 19:50
@MohamedMansour: I was thinking \u48 - \u58.. - Eric 2016-09-12 05:47
which font are you referring to in this pack? http://assets.onestore.ms/cdnfiles/external/mwf/long/v1/v1.4.0/css/mwf-west-european-default.css http://getmwf.co - Mohamed Mansour 2016-09-13 20:39
@MohamedMansour: Did you even read my answer? It's the one in that pack that has exactly the same name as the one in my answe - Eric 2016-09-13 20:47
Ads