0

How to Calculate String Length in Pixels in uwp in C#?

I found some answers to my question for previous versions, but not for UWP (Windows 10).

DaveQuick
  • 1
  • 1
  • 2
  • 2
    Questions seeking help must include *the desired behavior*, *a specific problem or error* and *the shortest code necessary* to reproduce it **in the question itself**. Questions without **a clear problem statement** are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – Gustavo Morales Jun 16 '16 at 01:59

1 Answers1

2

If you use xaml, you can create the textblock with your string, then call 'Measure' method. Following SO post may helps you.

How can I measure the Text Size in UWP Apps?

or if you using win2d,

How to calculate the size of a piece of text in Win2D

Community
  • 1
  • 1
Mamoru Satoh
  • 2,670
  • 23
  • 23