修改命名空间
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Markup;
|
||||
|
||||
using ShrlAlgoToolkit.RevitAddins.UI.Converters;
|
||||
using ShrlAlgoToolkit;
|
||||
using ShrlAlgoToolkit.RevitAddins;
|
||||
using ShrlAlgoToolkit.RevitAddins.UI;
|
||||
|
||||
namespace ShrlAlgoToolkit.RevitAddins.Common.Converters
|
||||
{
|
||||
public class EnumDescriptionExtension : MarkupExtension
|
||||
{
|
||||
private readonly object _enumValue;
|
||||
|
||||
public EnumDescriptionExtension(object enumValue)
|
||||
{
|
||||
_enumValue = enumValue;
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (_enumValue == null) return string.Empty;
|
||||
|
||||
var field = _enumValue.GetType().GetField(_enumValue.ToString());
|
||||
var attribute = field?.GetCustomAttributes(typeof(DescriptionAttribute), false)
|
||||
.FirstOrDefault() as DescriptionAttribute;
|
||||
|
||||
return attribute?.Description ?? _enumValue.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user