mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-04-19 06:53:50 +02:00
fixed
This commit is contained in:
parent
9ebeb7ad4b
commit
59d93a0212
1
App.xaml
1
App.xaml
@ -3,7 +3,6 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="clr-namespace:ModernWpfPlayground"
|
xmlns:local="clr-namespace:ModernWpfPlayground"
|
||||||
xmlns:propertyPresenter2="clr-namespace:ModernWpfPlayground.PropertyPresenter2"
|
|
||||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||||
StartupUri="MainWindow.xaml">
|
StartupUri="MainWindow.xaml">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
|
@ -28,10 +28,10 @@ namespace ModernWpfPlayground.PropertyPresenter2
|
|||||||
{
|
{
|
||||||
if (!(value is Enum enumValue)) return string.Empty;
|
if (!(value is Enum enumValue)) return string.Empty;
|
||||||
var descriptionAttribute = enumValue.GetType()
|
var descriptionAttribute = enumValue.GetType()
|
||||||
.GetField(enumValue.ToString()).GetCustomAttributes(false)
|
.GetField(enumValue.ToString())?.GetCustomAttributes(false)
|
||||||
.OfType<DescriptionAttribute>().FirstOrDefault();
|
.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)
|
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="geometry">geometry</param>
|
||||||
/// <param name="brush">color of the icon</param>
|
/// <param name="brush">color of the icon</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ImageSource GetIcon(Geometry geometry, Brush brush)
|
public static ImageSource GetIcon(Geometry geometry, Brush? brush)
|
||||||
{
|
{
|
||||||
if (brush == null)
|
if (brush == null)
|
||||||
brush = Brushes.Black;
|
brush = Brushes.Black;
|
||||||
@ -77,7 +77,7 @@ namespace ModernWpfPlayground.PropertyPresenter2
|
|||||||
FontStyles.Normal,
|
FontStyles.Normal,
|
||||||
FontWeights.Normal,
|
FontWeights.Normal,
|
||||||
FontStretches.Normal),
|
FontStretches.Normal),
|
||||||
64, brush);
|
64, brush, 1.5);
|
||||||
|
|
||||||
var geometry = formattedText.BuildGeometry(new Point(0, 0));
|
var geometry = formattedText.BuildGeometry(new Point(0, 0));
|
||||||
return GetIcon(geometry, null);
|
return GetIcon(geometry, null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user