You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
710 B
C#

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
public class FirstItemVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var items = parameter as System.Collections.IList;
if (items != null && items.Count > 0)
{
int index = items.IndexOf(value);
return index == 0 ? Visibility.Visible : Visibility.Collapsed;
}
return Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}