Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

423
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda