2015-03-18 4 views

ответ

3

XAML

<TextBlock Visibility="{Binding ElementName=Labour,Path=Items.Count, Converter={StaticResource ZeroToVisibilityConverter}}" TextWrapping="Wrap" Text="There is no data on this date" Margin="314,200,0,0" FontFamily="Arial" FontSize="14" Height="37" VerticalAlignment="Top" HorizontalAlignment="Left" Width="188"/> 

Преобразователь

public class ZeroToVisibilityConverter : IValueConverter 
{ 
    #region Implementation of IValueConverter 

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 
    { 
     return int.Parse(value.ToString()) == 0 ? Visibility.Visible : Visibility.Collapsed; 
    } 

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 
    { 
     throw new NotImplementedException(); 
    } 

    #endregion 
}