mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-06-30 01:40:51 +02:00
fixed
This commit is contained in:
@ -28,10 +28,10 @@ namespace ModernWpfPlayground.PropertyPresenter2
|
||||
{
|
||||
if (!(value is Enum enumValue)) return string.Empty;
|
||||
var descriptionAttribute = enumValue.GetType()
|
||||
.GetField(enumValue.ToString()).GetCustomAttributes(false)
|
||||
.GetField(enumValue.ToString())?.GetCustomAttributes(false)
|
||||
.OfType<DescriptionAttribute>().FirstOrDefault();
|
||||
|
||||
return descriptionAttribute?.Description ?? value.ToString();
|
||||
return descriptionAttribute?.Description ?? value.ToString() ?? string.Empty;
|
||||
}
|
||||
|
||||
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
|
@ -51,7 +51,7 @@ namespace ModernWpfPlayground.PropertyPresenter2
|
||||
/// <param name="geometry">geometry</param>
|
||||
/// <param name="brush">color of the icon</param>
|
||||
/// <returns></returns>
|
||||
public static ImageSource GetIcon(Geometry geometry, Brush brush)
|
||||
public static ImageSource GetIcon(Geometry geometry, Brush? brush)
|
||||
{
|
||||
if (brush == null)
|
||||
brush = Brushes.Black;
|
||||
@ -77,7 +77,7 @@ namespace ModernWpfPlayground.PropertyPresenter2
|
||||
FontStyles.Normal,
|
||||
FontWeights.Normal,
|
||||
FontStretches.Normal),
|
||||
64, brush);
|
||||
64, brush, 1.5);
|
||||
|
||||
var geometry = formattedText.BuildGeometry(new Point(0, 0));
|
||||
return GetIcon(geometry, null);
|
||||
|
Reference in New Issue
Block a user