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).

1
  • 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. Commented Jun 16, 2016 at 1:59

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

The first link answered my question. Thank you.
Please remember to mark the replies as answers if it helps you. Thanks! =)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.