Option One: Converter
Define the converter:
public class InverseBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return !((bool)value);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
//throw new NotImplementedException();
}
}
Usage in XAML:
<Label x:Name="MainLabel"
isVisible="{Binding IsVisibleEntry, Converter={Helpers:InverseBoolConverter}}"/>
XAML Header
xmlns:Helpers="clr-namespace:HikePOS.Helpers"
Option Two: Trigger
<Label x:Name="MainLabel" isVisible="{Binding IsVisibleEntry}">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding IsVisibleEntry}" Value="True">
<Setter Property="IsVisible" Value="False" />
</DataTrigger>
</Label.Triggers>
</Label>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…