I have the following two GridViewColumns in a GridView in WPF:
<GridViewColumn Header="Payment">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=LocalAmount}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Deposit">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=LocalAmount}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
What I would like to do is that if ‘LocalAmount’ is positive, it is shown only in the ‘Deposit’ column, and when negative, only shown in the ‘Payment’ column (without the negative sign).
Is there an easy way to achieve this?
Thanks a lot!
You can use two different value converters. One of them displays the value if it is positive, and the other one if it is negative.
Useful links: