Error when binding using markup extensions: Unknown property encountered while parsing a Markup Extension

It's a bug that can occur with nested MarkupExtensions. Try putting your custom Markup into a separate DLL/Project or use property element syntax.

  • http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/8427e852-0f4f-49b1-9810-28ef6f3bcf09/

  • http://webcache.googleusercontent.com/search?q=cache:viDdmFIGtq8J:www.hardcodet.net/2008/04/nested-markup-extension-bug+&cd=1&hl=en&ct=clnk&gl=uk


WPF doesn't handle nested markup extensions too well. To overcome this, you can use your markup extension as an element. It's a bit clumsy and harder to read, but it works:

<RadioButton GroupName="F1" Content="Filter Number One">
    <RadioButton.IsChecked>
        <Binding Path="Filter">
            <Binding.Converter>
                <local:TrueWhenEqual To={x:Static local:ViewModelClass.Filter1} />
            </Binding.Converter>
        </Binding>
    </RadioButton.IsChecked>
</RadioButton>

Another way would be to declare your converter and use it as a static resource:

<Window.Resources>
    <local:TrueWhenEqual To={x:Static local:ViewModelClass.Filter1} x:Key="myConverter" />
</Window.Resources>

<RadioButton GroupName="F1" Content="Filter Number One"
             IsChecked="{Binding Filter, Converter={StaticResource myConverter}}" />