Skip to main content

Microsoft Silverlight

Answered Question Putting ValueConverter reference in ResourceDictionary (Fails)RSS Feed

(0)

philjones
philjones

Member

Member

60 points

106 Posts

Putting ValueConverter reference in ResourceDictionary (Fails)

 I have a ValueConvter, which works find when referenced within the XAML within an actual control.  Eg:

        <Grid.Resources>
<Search:IsReadIconConverter x:Key="isReadIconConverter" />
<DataTemplate x:Key="IsReadCell">
<Image Source="{Binding Converter={StaticResource isReadIconConverter}}" Stretch="None" />
</DataTemplate>
</Grid.Resources>
 
However, if I try and factor this out into a resource dictionary I get an 'AG_E_PARSER_BAD_TYPE' error, due to the
 
<Search:IsReadIconConverter x:Key="isReadIconConverter" />

 ...just sitting in the ResourceDictionary.  Is there something different I need to do to put a ValueConverter class reference of this kind in a ResourceDictionary?

Thanks!

---
Phil Cockfield

MarkTap
MarkTap

Participant

Participant

1442 points

263 Posts

Re: Putting ValueConverter reference in ResourceDictionary (Fails)

Is your converter class public?

philjones
philjones

Member

Member

60 points

106 Posts

Re: Putting ValueConverter reference in ResourceDictionary (Fails)

Yes, it is public - and it's working in the context of the control. I wonder if it's a bug in the new MergedDictionaries code within SL3. Thanks. P

---
Phil Cockfield

Tomek Kmiecik
Tomek Km...

Member

Member

356 points

69 Posts

Microsoft
Answered Question

Re: Putting ValueConverter reference in ResourceDictionary (Fails)

Hey,

How do you define your xmlns:Search namespace? Probably you are using just the namespace, without the assembly name:

xmlns:Search='clr-namespace:MyNamespace;MyAssembly'

Best regards,
Tomek

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities