30 lines
874 B
C#
30 lines
874 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
|
|
namespace _29WxOrderWpf.Converters
|
|
{
|
|
internal class ListBoxIndexConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type TargetType, object parameter, CultureInfo culture)
|
|
{
|
|
ListBoxItem item = (ListBoxItem)value;
|
|
ListBox listView = ItemsControl.ItemsControlFromItemContainer(item) as ListBox;
|
|
if (listView == null)
|
|
return 0;
|
|
|
|
return listView.ItemContainerGenerator.IndexFromContainer(item) + 1;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|