Написать преобразователь значения, скажем IsGreaterThanZero
, затем написать свой XAML как,
<Window.Resources>
<local:IsGreaterThanZero x:Key="isGreaterThanZero"/>
</Window.Resources>
<DataTrigger Binding="{Binding Role.Count, Converter={StaticResource isGreaterThanZero}" Value="True">
<Setter TargetName="Counts" Property="Visibility" Value="Hidden" />
</DataTrigger>
И IsGreaterThanZero можно записать как,
public class IsGreaterThanZero: IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return Int32.Parse(value as string) > 0;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException() ;//"PresenterConverter.ConvertBack() is not implemented!");
}
#endregion
}