using System;
|
using System.Globalization;
|
using System.Windows.Controls;
|
using System.Windows.Data;
|
|
namespace HMI.UI.Converter
|
{
|
public class DataGridRowNumberConverter : IValueConverter
|
{
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
{
|
if (value is DataGridRow row)
|
{
|
return row.GetIndex() + 1;
|
}
|
return -1;
|
}
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
{
|
return value;
|
}
|
}
|
|
//public class ListBoxItemIndexConverter : IValueConverter
|
//{
|
// public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
// {
|
// if (value is ListBoxItem row)
|
// {
|
// return row.GetIndex() + 1;
|
// }
|
// return -1;
|
// }
|
|
// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
// {
|
// return value;
|
// }
|
//}
|
}
|