Using VS2017
WPF application
.Net Framework 4.72
--------------------------
I've got a converter that I added to a xaml file, but the xaml designer is telling me this:
The name "BoolToColorConverter" does not exist in the namespace "clr-namespace:WpfCommon.Converters;assembly=WpfCommon"
As you can see by the code below, it DOES exist in the namespace. Furthermore, I have other converters declared - IN THE SAME NAMESPACE - and they don't show any errors.
I live in the designer, and this problem is preventing the markup from being displayed.
Despite all of the above, the app compiles and runs fine, and the converter does what it's supposed to do.
using System;
using System.Windows.Data;
using System.Windows.Media;
namespace WpfCommon.Converters
{
public class BoolToColorConverter : IValueConverter
{
public string ValueIfFalse { get; set; }
public string ValueIfTrue { get; set; }
public BoolToColorConverter()
{
ValueIfFalse = "Red";
ValueIfTrue = "Green";
}
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
bool condition = (bool)value;
string colorName = (condition) ? this.ValueIfTrue : this.ValueIfFalse;
SolidColorBrush brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString((string)colorName));
return brush;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Added the obligatory definition in my XAML:
<wpfctrls:WizardPageBase x:Class="EntityFactory.WizardPages.WizPgSettings2"
xmlns:converters="clr-namespace:WpfCommon.Converters;assembly=WpfCommon">
<wpfctrls:WizardPageBase.Resources>
<converters:BoolToColorConverter x:Key="BoolColorConverter" ValueIfTrue="Red" ValueIfFalse="SteelBlue"/>
</wpfctrls:WizardPageBase.Resources>
And added it to the appropriate property in the control:
<Button Background="{Binding Path=AppSettings.IsModified,Converter={StaticResource BoolColorConverter}}" />
What I have tried:
I've tried rebuilding the WpfCommon assembly on its own.and moving the declaration up and down the list of other declared converters.