1、编写转换器类
namespace Eastups.Utility.Converters
{
public class MenuNameConvert : IValueConverter
{
#region Public Property
public IList<MenuInfo> DataSource = new List<MenuInfo>();
#endregion
#region public Methods
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string menuName = string.Empty;
try
{
int menuId = (int)value;
menuName = DataSource.Where(o => o.ID == menuId).FirstOrDefault().Menu_Name;
}
catch (Exception ex)
{
Eastups.Utility.Logger.Write(LogType.Error, ex.Message.ToString());
}
return menuName;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.Cult