views:

46

answers:

1

Sorry for the F#...

I have a VS project with the following class:

namespace ABCCommonSilverlight

module ConvertersAndFormatters =
    type FixedDecimalConverter () =
        interface  IValueConverter with
            member this.Convert(value, targetType, parameter, culture) = 
                if value = null then
                    "N/A" :> obj
                else
                    (decimalFormatter (value :?> Double)) :> obj
            member this.ConvertBack(value, targetType, parameter, culture) = raise <| NotImplementedException()

And I've referenced this project in another project which has a xaml resources file which looks like this...

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:y="clr-namespace:ABCCommonSilverlight;assembly=ABCCommonSilverlight">

  <y:ConvertersAndFormatters.FixedDecimalConverter x:Key="abcFixedDecimalConverter" />
</ResourceDictionary>

Without the "ConvertersAndFormatters." in front of FixedDecimalConverter I get Exception "The type 'FixedDecimalConverter' was not found." and with the "ConvertersAndFormatters." I get Exception "Cannot set properties on property elements."

Any idea what the right way to do this is?

A: 

The first thing I would try is moving the FixedDecimalConverter type out of the module, so that it's sitting directly in a namespace. (Right now the CLI and XAML see it as a nested class inside the module class.)

Brian