I\'m learning WPF and I encountered the following problem:
I have an enum type in another namespace than my XAML:
public enum NodeType
{
Type_SYS
I had a similar question here, and my end result was to create a generic IValueConverter that passed the enum value I wanted to match in as the ConverterParameter, and it returns true or false depending on if the bound value matches the (int) value of the Enum.
The end result looks like this:
XAML Code:
Converter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (parameter == null || value == null) return false;
if (parameter.GetType().IsEnum && value is int)
{
return (int)parameter == (int)value;
}
return false;
}