0
我有一個與不是UserControl後代的類關聯的XAML文件。我正嘗試使用值轉換器將字符串轉換爲POCO。這個問題是我似乎無法得到轉換器被選爲靜態資源。我收到以下錯誤:Value Converter未在XAML類中解析
The resource "myConverter" could not be resolved.
任何想法?
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; }
}