Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

422
Views
WPF binding replace zeros with blanks

I have this WPF xaml binding element below:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Value, StringFormat='0.00'}" />

If Value is 0, I would like it to display an empty string.

I've tried:

DataMemberBinding="{Binding TotalStops, StringFormat='{}{0:#.#0}'}"

But when Value is 0, it displays .00 instead of an empty string.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

In WPF, StringFormat support the ";" section separator.

Try this:

DataMemberBinding="{Binding Value, StringFormat={}{0:#.#0;(0);''}}"

This example shows 3 value formats: positive, negative, and zero value formatting from left to right, separated by semi-colons.

enter image description here

The image reference from article by Muhammad Shujaat Siddiqi


This is just not limited to WPF, this can work with where ever a string format is used in general.

double x = 0.00;
x.ToString("#.#0;;A BIG ZERO");
Console.WriteLine(x);
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!