In a datagrid, show empty instead of 0
Simonlabdes opened this issue · comments
First, i dont want to use decimal? type for every of my field...
So, in my datagridTextColumn, I have the following WORKING statement :
<DataGridTextColumn Header="MyValue" Binding="{conv:Binding '(MyValue==0?-1:MyValue)', StringFormat=C}" />
What it will do, is that when the binded property of the itemSource item is eqal to 0, it replace the 0 per -1. If not 0, then the normal value is shown.
HOWEVER, my real goal here is to show '-' if the value is zero. But I am unable to succeed, because of tons of parsing Error. here are my tries :
<DataGridTextColumn Binding="{conv:Binding '(ProchainCoutant==0?\'-\':ProchainCoutant)'}"/>
ERROR : MarkupExtension is not properly closed
<DataGridTextColumn Binding='{conv:Binding Path="(ProchainCoutant==0?\'-\':ProchainCoutant)"}'/>
ERROR : expected : "
in fact, my problem is that basically, I am just unable to set any quote (\'
) in my formula