AutoCompleteBox XAML Error with Regions

Topics: Prism v2 - Silverlight 3
Apr 1, 2010 at 12:08 AM

Hello,

I am using PRISM v2 with Silverlight 4 beta (No VWD Express RC => No Silverlight RC). I have a module with a view named "MyView.xaml" in it. This view shows up in a region in the Shell page.

When I add AutoCompleteBox using xaml and run the application and navigate to the page, I get Parser Error. If I add the AutoCompleteBox using code behind, it works.

I am assuming it is because I am using Regions that this error is coming up since if I add the AutoCompleteBox in the Shell page(XAML) as a sibling to other ItemsControl's, it works.

Any thoughts?

Thanks.

Developer
Apr 14, 2010 at 3:47 PM

Hi,

The exception is probably caused because the System.Windows.Controls.Input assembly is not included in the main XAP file at the moment the XAML is parsed. Silverlight XAML parser needs the assembly to be deployed in the main xap file in order to map it to a namespace, so a XamlParseException is thrown if that isn’t the case. You can find more information about the aforementioned behavior in this article.

A possible solution to that problem could be to add a reference to the System.Windows.Controls.Input assembly from the Shell project.

You can also check this article, which clarifies that assemblies that are loaded in the main application don’t necessarily have to be in the modules’ XAP files under certain conditions.

I hope you find this helpful.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi