Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7400361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:14:19+00:00 2026-05-29T04:14:19+00:00

I have failed to find a Windows Runtime equivalent to the following WPF code

  • 0

I have failed to find a Windows Runtime equivalent to the following WPF code to measure the width of a string:

FormattedText formattedText = new FormattedText(in_string,in_culture,in_flowdir,in_font,in_sz,in_color);
string_width = formattedText.WidthIncludingTrailingWhitespace);

Does anybody know if it can be done in Metro?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:14:20+00:00Added an answer on May 29, 2026 at 4:14 am

    It is possible, I’ve found one method that gives useful measurements, but I am not sure it is the best way of doing it:

    // Setup the TextBlock with *everything* that affects how it 
    // will be drawn (this is not a complete example)
    TextBlock^ tb = ref new TextBlock; 
    tb->VerticalAlignment = Windows::UI::Xaml::VerticalAlignment::Top; 
    tb->HorizontalAlignment = Windows::UI::Xaml::HorizontalAlignment::Left; 
    tb->Height = in_height; 
    tb->Text = text;
    
    // Be sure to tell Measure() the correct dimensions that the TextBox 
    // have to draw in!
    tb->Measure(SizeHelper::FromDimensions(Parent->Width,Parent->Height)); 
    text_width = tb->DesiredSize.Width;
    

    My gut feeling is that there are situations in which this code will give an unexpected result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Is there an equivalent of ‘which’ on windows? Failed to find it
I have the following code: $bind = new COM(LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local); When I execute it from
I have this quite popular problem, but have failed to find a solution that
I have tried to do some reading about it, but I failed to find
gem install heroku failed with following message and I have tried the solution here
I have this code, showmessage('C:\TEMP\'+openfiles[openfilelist.ItemIndex].ID); if removedir('C:\TEMP\'+openfiles[openfilelist.ItemIndex].ID) then showmessage('Removed') else showmessage('Failed'); The message shows
I have idea to implement my wpf windows like TabPages in tab control. It
I have the following code. QString fileName = QFileDialog::getSaveFileName( this, tr(Output Image file), (),
I am new to windows programming and have written a small utility with mingw
My google search skills have failed me, and I am not a database expert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.