views:

88

answers:

1

In XAML-file of the SquadView page (VfmElitaSilverlightClientView.Pages.SquadView) I am using custom value converter. XAML-file is in "VfmElitaSilverlightClientView" namespace. Separate folder was created for converter and it is in "VfmElitaSilverlightClientView.Converter" namespace (in the same assembly). To use converter following code is used in XAML:

xmlns:Converter="clr-namespace:VfmElitaSilverlightClientView.Converter"
...
<NavigationControls:Page.Resources>
    <Converter:BooleanToVisibilityConverter x:Key="resourceBooleanToVisibilityConverter" />
</NavigationControls:Page.Resources>

All works fine. Here I want to move converter class into a custom separate assembly "SilverlightCommonView" and class himself will be in "SilverlightCommonView.Converter" namespace. The XAML code is changed to the following:

xmlns:Converter="clr-namespace:SilverlightCommonView.Converter;assembly=SilverlightCommonView" 
...
<NavigationControls:Page.Resources>
    <Converter:BooleanToVisibilityConverter x:Key="resourceBooleanToVisibilityConverter" />
</NavigationControls:Page.Resources>

In this case when application throws following exception:

An unhandled exception ('Unhandled Error in Silverlight Application... Code: 4004 Category: ManagedRuntimeError Message: Microsoft.Practices.Unity.ResolutionFailedException: Resolution of dependency failed, type="VfmElitaSilverlightClientView.Pages.SquadView", name="(none)". Exception occurred while: Calling constructor VfmElitaSilverlightClientView.Pages.SquadView(). Exception is: XamlParseException - The type 'BooleanToVisibilityConverter' was not found because 'cl...:SilverlightCommonView.Converter;assembly=SilverlightCommonView' is an unknown namespace.

It's unclear why specified namespace is unknown (those assembly is referenced by the current one).

Please advise.

Any thoughts are welcome.

+1  A: 

I'd bet you do not have an assembly reference to your shared/common project from your application project.

Adam Sills
You was almost right. Reference was absent, but not in assembly that contained view class, but in application that references to "view"-assembly. When reference to 'SilverlightCommonView' was added into 'Application' project - problem was resolved. Thanks again, your answer gave me ability to be more confident in the XAML source code.
Budda
No, that's what I said. "...TO your shared/common project FROM your application...". So rephrased, your application needed a reference to the common project.
Adam Sills