public static string ToDescriptionString(this ScheduleUserStatus val) { DescriptionAttribute[] attributes = (DescriptionAttribute[])val .GetType() .GetField(val.ToString()) .GetCustomAttributes(typeof(DescriptionAttribute), false); return(attributes.Length > 0 ? attributes[0].Description : string.Empty); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { ScheduleUserStatus userStatus = (ScheduleUserStatus)value; if (userStatus == ScheduleUserStatus.Urgent) { return(Color.White); } else { return(Color.FromHex("#147e88")); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { ScheduleUserStatus userStatus = (ScheduleUserStatus)value; return(userStatus.ToDescriptionString()); }