tags:

views:

41

answers:

1

Hi,

I have a custom class that extends "Control" like so:

class TheCountry : Control
{
//...details
}

Then I have that element in my XAML:

<Canvas x:Name="mainCanvas" Height="768" Width="1536" AllowDrop="False">
            <spots:TheCountry Country="Australia" Canvas.Left="1362" Canvas.Top="486" Template="{DynamicResource TheCountryIcon}" />
</Canvas>

And in my resources I have the template:

<UserControl.Resources>
<ControlTemplate x:Key="TheCountryIcon" TargetType="{x:Type spots:TheCountry}">
            <Grid Width="35" Height="35">
                <Image Source="{TemplateBinding Property=CountryImagePath}" Width="35" Height="35" AllowDrop="True"/>
            </Grid>
        </ControlTemplate>
</UserControl.Resources>

and I have the dependancy property called: CountryImagePath in my TheCountry class, but when I run my app, I do not get the image showing up...

I have even put a break point on the getter in the dependancy property, and it does not get hit...

Pleas help!

thanks Mark

+1  A: 

Breakpoints in dependency properties don't actually work - WPF bypasses the getter and setter once the binding is established. Have a look at this post from Bea Stollnitz for some tips for debugging bindings:

How can I debug WPF bindings?

What you're doing sounds reasonable. Are you certain the "CountryImagePage" is set correctly?

Matt Hamilton
Yeah Im pretty certain, Ill look into those debugging techniques, thanks
Mark