0

I have a XAML file associated with a class that is not a UserControl descendant. I am trying to convert a string into a POCO using a value converter. This problem is I can't seem to get the converter to be picked up as a static resource. I get the following error:

The resource "myConverter" could not be resolved.

Any ideas?

XAML

<blst:StreamFactory
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:blst="clr-namespace:myNamespace">

    <blst:StreamFactory.Resources>
        <blst:StreamFormatConverter x:Key="MyConverter"/>
    </blst:StreamFactory.Resources>

    <blst:StreamFactory.AvailableStreams>
        <blst:StreamInfo>
            <blst:StreamInfo.Format>
                <Binding Converter="{StaticResource MyConverter}" ConverterParameter="MP3"/>
            </blst:StreamInfo.Format>
        </blst:StreamInfo>
    </blst:StreamFactory.AvailableStreams>

</blst:StreamFactory>

C#

class StreamFactory
    {
        public ResourceDictionary Resources { get; set; }

        public List<StreamInfo> AvailableStreams { get; private set; }
    }
Chris Gonzales
  • 1,180
  • 1
  • 13
  • 31

1 Answers1

0

Declare StreamFormatConverter outside this xaml. For example: in App.xaml. I think your Resources not like UserControl.Resources. It maybe not loaded in Memory.

ebattulga
  • 10,774
  • 20
  • 78
  • 116