46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace DM_Weight.Converter
|
|
{
|
|
internal class DrawerContentConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
//int iLength = value[0].ToString().Length;
|
|
//int ButtonDrawerNo = int.Parse(value[0].ToString().Substring(0, iLength-3));
|
|
//int SelectedDrawerNo = int.Parse(value[1].ToString());
|
|
//return ButtonDrawerNo == SelectedDrawerNo;
|
|
if (value!=null)
|
|
{
|
|
string name = value.ToString();
|
|
string num = parameter.ToString();
|
|
if (!string.IsNullOrEmpty(name))
|
|
{
|
|
return num + " " + name;
|
|
}
|
|
else
|
|
return num;
|
|
}
|
|
else if(!string.IsNullOrEmpty(parameter.ToString()))
|
|
{
|
|
return parameter.ToString();
|
|
}
|
|
else
|
|
|
|
return "";
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|