Mysterious red border appears around ComboBox
Make sure whatever you're binding to exactly the expected datatype.
I had this 'mysterious red box' when I tried to bind a list of decimal
objects but my MVVM property type was int
. Check and double check all your SelectedValue
, DisplayMemberPath
, and SelectedValuePath
properties if you're using them - and make sure you're not using SelectedValue
when you meant to use SelectedItem
.
Look in the debug console for binding errors like this :
System.NotSupportedException: Int32Converter cannot convert from System.DecimalSystem.Windows.Data Error: 7 : ConvertBack cannot convert value '7' (type 'Decimal'). BindingExpression:Path=SharedProductHistoryFilterCriteria.FilterDays; DataItem='PricingManagerViewModel' (HashCode=19425465); target element is 'ComboBox' (Name=''); target property is 'SelectedValue' (type 'Object') NotSupportedException:'System.NotSupportedException: Int32Converter cannot convert from System.Decimal. at MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward) at MS.Internal.Data.ObjectTargetConverter.ConvertBack(Object o, Type type, Object parameter, CultureInfo culture) at System.Windows.Data.BindingExpression.ConvertBackHelper(IValueConverter converter, Object value, Type sourceType, Object parameter, CultureInfo culture)'