dotnet/wpf · error · NotImplementedException
new NotImplementedException()
Error message
new NotImplementedException()
What it means
RibbonWindowSmallIconConverter is a one-way value converter: only Convert is implemented. ConvertBack always throws NotImplementedException because converting an icon ImageSource back to the source object is not meaningful for the ribbon window's small-icon binding.
Solutions
- Change the binding to Mode=OneWay (or OneTime) so ConvertBack is never invoked.
- Use a different/custom converter with a real ConvertBack if reverse conversion is needed.
- Write a custom converter class for your scenario rather than reusing this internal-purpose converter.
Example fix
// before
<Image Source="{Binding Icon, Converter={StaticResource RibbonWindowSmallIconConverter}, Mode=TwoWay}"/>
// after
<Image Source="{Binding Icon, Converter={StaticResource RibbonWindowSmallIconConverter}, Mode=OneWay}"/> Defensive patterns
Strategy: try-catch
Try / catch
try { value = converter.ConvertBack(v, typeof(object), null, CultureInfo.CurrentCulture); }
catch (NotImplementedException) { value = Binding.DoNothing; } Prevention
- Only use RibbonWindowSmallIconConverter in one-way bindings.
- Set Mode=OneWay explicitly on reusing bindings.
- Never attach it to editable/two-way controls.
When it happens
Trigger: Using RibbonWindowSmallIconConverter in a TwoWay or OneWayToSource binding (Binding with Mode=TwoWay, or UpdateSourceTrigger firing on the bound property), so WPF calls ConvertBack.
Common situations: Developers reusing the converter in their own bindings (e.g. Icon bound TwoWay by default in some scenarios) instead of one-way icon display bindings.
Related errors
- new NotSupportedException()
- ArgumentOutOfRangeException(parameterName)
- ArgumentOutOfRangeException(parameterName)
- InvalidEnumArgumentException(nameof(value)…
- Microsoft.Windows.Controls.SR.ElementNotKeyTipScope
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/665e7fbe84275222.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/System.Windows.Controls.Ribbon/Microsoft/Windows/Controls/Ribbon/Primitives/RibbonWindowSmallIconConverter.cs:43
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
ImageSource imageSource = value as ImageSource;
ImageSource returnImageSource = null;
if (imageSource != null)
{
returnImageSource = GetSmallIconImageSource(imageSource);
if (returnImageSource == null)
{
returnImageSource = imageSource;
}
}
return returnImageSource;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
#region Helper Methods
private ImageSource GetSmallIconImageSource(ImageSource imageSource)
{
#if RIBBON_IN_FRAMEWORK
Size size = new Size(SystemParameters.SmallIconWidth, SystemParameters.SmallIconHeight);
#else
Size size = Microsoft.Windows.Shell.SystemParameters2.Current.SmallIconSize;
#endif
bool asGoodAsItGets = false;
var bf = imageSource as BitmapFrame;
if (bf != null && bf.Decoder != null && bf.Decoder.Frames != null && bf.Decoder.Frames.Count > 0)
{View on GitHub (pinned to 81131a70a4)