Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

424
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda