Quantcast
Channel: WP8/XAML - Measure string length in pixels - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by PTwr for WP8/XAML - Measure string length in pixels

Solution working on WP8 device (tested on HTC 8S and Lumia 920) public int TextWidth(string text) { TextBlock t = new TextBlock(); t.Text = text; //Height and Width are depending on font settings...

View Article



Answer by crea7or for WP8/XAML - Measure string length in pixels

Try this:t.Measure( new Size( 1000, 1000 );t.Arrange( new Rect( 0, 0, 1000, 1000 );t.UpdateLayout();

View Article

WP8/XAML - Measure string length in pixels

Pixel-length measuring code, like this one:public int TextWidth(string text) { TextBlock t = new TextBlock(); t.Text = text; t.Measure(new Size(1000, 1000)); return (int)t.DesiredSize.Width; }Is not...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images