I want to show a number on screen. If that number is 0 I don't want it to show at all.
<TextBlock Text="{Binding Path=Class.Count}" FontSize="20" FontWeight="Bold">
<TextBlock.Triggers>
<DataTrigger Binding="{Binding Path=Class.Count}" Value="0">
<Setter Property="TextBlock.Text" Value=""/>
</DataTrigger>
</TextBlock.Triggers>
</TextBlock>
I attempted the above piece of code after a regular trigger failed to solve my problem. I do not want to write a converter to act upon one specific number. Is there a way to create a trigger that will hide the number if it is 0?
EDIT: When I try to use a regular trigger or a data trigger I get a xaml parse error telling me I need to use an event trigger.
I tried to set the value in the setter to a number to make sure that having a blank value was not causing the problem