views:

84

answers:

0

In my App.xaml file I defined folowing Control Template :

<ControlTemplate x:Key="PushPinTemplate">
        <Grid>
            <Image Source="Images/konzum.png" Width="35" Height="35" />
            <TextBlock Text="{Binding numberOfChildren}" />
        </Grid>
</ControlTemplate>

And in my Main.xaml.cs file I'm adding Pushpins to a BING map using SL Bing control :

    foreach (var p in prodavaonice)
    {
        Pushpin pin = new Pushpin();
        Location lokacija = new Location(p.X - xOffset, p.Y - yOffset);

        pin.Location = lokacija;                
        pin.Template = Application.Current.Resources["PushPinTemplate"]  as ControlTemplate;
    }

My question is what is the easiest way to bind some data (in my case ordinary string which represent number of pin childrens, because I'm doing clustering) to a pin's Template which I defined in App.xaml. Exactly I want to bind data from Main.xaml.cs to this line of code in Control Template :

... <TextBlock Text="{How to bind???}" /> ...

Thank you in advance!