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

  • Home
  • SEARCH
  • 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 8502205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:25:10+00:00 2026-06-11T01:25:10+00:00

I am working with WPF and C# and I want to format a set

  • 0

I am working with WPF and C# and I want to format a set of digits (not currency or number) with StringFormat in a TextBlock.

Example: 456321789 (string)

And I want to show it in the TextBlock like 456 321 789.

This examples doesn’t work:

<TextBlock Text="{Binding Number, StringFormat=000 000 000"/>

<TextBlock Text="{Binding Number, StringFormat=### ### ###"/>

<TextBlock Text="{Binding Number, StringFormat={}{0:000 000 000}"/>

<TextBlock Text="{Binding Number, StringFormat={}{0:### ### ###}"/>

Sometime ago I tried to format a set of 7 digits like 5432-123. And I wasn’t successful.

I tried many examples, and noting works with. What I am doing wrong?

Note: The only way I can achieve this is if I have the set of digits as an integer. But I’d like to understand why I can’t do it with a string.

Thanks in advance!

  • 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-06-11T01:25:12+00:00Added an answer on June 11, 2026 at 1:25 am

    The string formats you are using are only applicable to integers, according to the documentation. So in order to get the desired formatting, you have to bind to a number. not a string.

    If you think a little, there is a reason behind that: the formatting like digit grouping is only interesting for numbers and not to generic strings like “helloworld”. So noone cared about implementing such formats for generic string.

    Sorry for that.

    (A question aside: if your data is guaranteed to be a string representation of a number, why don’t you keep the value as an int then?)

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

Sidebar

Related Questions

i am working with wpf media element.i want to change the media element source
I am working on WPF app and I want to get news feed using
I am working with WPF. I want to create keyboard shortcuts for my WPF
I'm working with WPF and EF. I'm using a Datagrid to show information. In
I am working in WPF and I need to set the Text and ToolTip
I am working on wpf PropertyGrid (PG) control and I want the PG to
Hello Guys I am working WPF app and I want to retrive all the
I am working on WPF application and I want to retrieve News Feed using
I m working with WPF DataGrid and I want to retrieve a DataGridCell 's
Hello Guys I am working on WPF app and I want to Unlike the

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.