How can I refer to a binding converter in another namespace in Silverlight XAML?
- by Mike Pateras
Since you apparently can't create a Silverlight DataTemplate in C#, I'm trying to create one in XAML. I have a converter that I need to refer to, that I have defined in C# in another namespace. I've tried doing this:
<UserControl.Resources>
<DataTemplate x:Key="PriceTemplate">
<TextBlock Text="{Binding Price, Converter={Converters:PriceConverter}}" />
</DataTemplate>
</UserControl.Resources>
Where Converters is an xmlns that points to the correct namespace. However, I get a compilation error that says:
Type 'Converters:PriceConverter' is
used like a markup extension but does
not derive from MarkupExtension.
I tried adding System.Windows.Markup.MarkupExtension as a parent to my converter, but it apparently doesn't exist in Silverlight.
How can I refer to my converter in XAML, without having to rewrite it in XAML?