AG_E_PARSER_BAD_PROPERTY_VALUE when using Action Parameter

Nov 17, 2010 at 7:20 AM

Hi all,

I am using Caliburn Micro in a new WP7 project and like it a lot but there is one thing bugging me and I have spent quite some time trying to figure it out without any success.

When I use actions with parameters like the sample in the documentation I get a XamlParserException with the AG_E_PARSER_BAD_PROPERTY_VALUE message on the <cal:Parameter... line.

I written my own code but also tried to use the exact code from the sample (seen here below) and neither works.

Any help is much appreciated.


        <TextBox x:Name="Name" />
        <Button Content="Click Me">
                <i:EventTrigger EventName="Click">
                    <cal:ActionMessage MethodName="SayHello">
                        <cal:Parameter Value="{Binding ElementName=Name, Path=Text}" />


Nov 17, 2010 at 12:54 PM

See the thrid footnote in the docs:

Parameters databound parameters do not work in WP7 do to the fact that WP7 is based on SL3 and is missing some important infrastructure to make it possible. You can use literal and special value parameters though.

Nov 17, 2010 at 1:15 PM

Thanks for the quick reply. I should have read the footnotes :)

A follow-up question then as this was a workaround on another problem I had.

I initially had a text box that caliburn automatically bound to the ViewModel but then I replaced the text box with the AutoCompleteBox from the SL toolkit. Now I would still like the Text property bound to the property with the same name on the VM but it is not. Can I specify this manually somehow?

Or what would be your preferred way of sending the content of the AutoCompleteBox to the VM on a Button's Click event?


Nov 17, 2010 at 1:26 PM

This is definitely a situation I would handle via standard databinding. If you want to do this by convention, you will need to add a convention for the AutoCompleteBox. To do this you will need to add some custom code to your bootstrapper's configure method. This is what the configuration looks like for a TextBox:

ConventionManager.AddElementConvention<TextBox>(TextBox.TextProperty, "Text", "TextChanged");

You can just change the parameters to be appropriate for AutoCompleteBox. The first parameter is the conventional property to databind, the second parameter is the conventional property to use for action parameters (not applicable to WP7 yet) and the third parameter is the conventional event to wire actions to.

Nov 17, 2010 at 2:46 PM

Ahh! :)

Thank you very much :)