30 lines
782 B
C#
30 lines
782 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
|
|
namespace AxCopilot.Themes;
|
|
|
|
public class IndexToNumberConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type t, object p, CultureInfo c)
|
|
{
|
|
if (value is ListViewItem container)
|
|
{
|
|
ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer((DependencyObject)(object)container);
|
|
if (itemsControl != null)
|
|
{
|
|
int num = itemsControl.ItemContainerGenerator.IndexFromContainer((DependencyObject)(object)container);
|
|
return (num >= 0 && num < 9) ? (num + 1).ToString() : "";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public object ConvertBack(object v, Type t, object p, CultureInfo c)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|