I've got a UserControl that contains a menu. I need to bind the Menu.Icon to a property of the UserControl but it's not working.
The code starts like this -
<Border Grid.Row="0">
<DockPanel>
<Image x:Name="testImage" Height="16" Width="16" Source="{Binding ElementName=UC,Path=AddImage}"/>
<Menu DockPanel.Dock="Left" Height="20"
VerticalAlignment="Center">
<MenuItem Header="{Binding ElementName=UC,Path=AddText}">
<MenuItem.Icon>
<!--<Image x:Name="workswhenin" Height="16" Width="16" Source="pack://application:,,/Kowdox;component/Images/UserIcons/user_add.png"/>-->
<Image x:Name="realImage" Height="16" Width="16"
Source="{Binding ElementName=UC,Path=AddImage}"/>
</MenuItem.Icon>
</MenuItem>
The first Image you see declared (testImage) works perfectly so I'm happy that the binding is correct. The second Image (commented out and named 'workswhenin') contains the pack URI that I'm passing to the UserControls bound property and that works too but the third one (realImage) doesn't appear at all!
I can't see ANY reason why it shouldn't work; i know the binding is good and i know that the image's placement in the markup is good so what's going on?
Any help will be greatly appreciated. Thanks in advance.