Provide value on 'System.Windows.Baml2006.DeferredBinaryDeserializerExtension' threw an exception


In this article we will see how to resolve the following error when you build and run a WPF based application in visual studio 2010 or greater: Provide value on 'System.Windows.Baml2006.DeferredBinaryDeserializerExtension' threw an exception.

In this article we will see how to resolve the following error in a WPF based application:
Provide value on 'System.Windows.Baml2006.DeferredBinaryDeserializerExtension' threw an exception

Generally this kind of error occurs when you are using a static property from you XAML page in a WPF application. In order to resolve this issue, When you are trying to access the statuc property we must use the {x:Static} markup extension.

For ex:
<Ellipse Stroke="Pink" Height="50" Fill="SystemColors.DesktopBrush"></Ellipse>

can be replaced with following markup:

<Ellipse Stroke="Pink" Height="50" Fill="{x:Static SystemColors.ActiveCaptionBrush}"></Ellipse>

or
<Ellipse Stroke="Pink" Height="50" Fill="{x:Static SystemColors.DesktopBrush}"></Ellipse>

in the above example {x:Static} is a markup extension using which we can access any static property.

A Markup extension is a class which derives from System.Windows.Markup.MArkupExtension and it implements the method: ProvideValue.


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: