Thanks Graeme - I did run across that one - but decided to run through each step of it slowly and deliberately. In doing so I found out how to do what I needed - so, although this was still more about working entirely within WPF, I was able to "interpolate" what I needed. So for anyone else wanting to enable custom pushpins on a WPF control in a WinForms application - here's how it's done.
In your WPF usercontrol you will need to add a section called
<usercontrol.resources> as follows
<UserControl.Resources>
<ControlTemplate x:Key="yourtemplatenamehere" TargetType="m:Pushpin">
.... the template constructors here
</ControlTemplate>
</UserControl.Resources>
Put this second just above the <grid> section.
Now the example had a fairly ugly pushpin defined in the ControlTemplate, so I improved on it (with a lot of experimenting). So my entire ControlTemplate looks like this
<UserControl.Resources >
<ControlTemplate x:Key="MyNewPushpin" TargetType="m:Pushpin">
<Grid x:Name="ContentGrid" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel>
<Grid Margin="0" Width="24" Height="23">
<Rectangle HorizontalAlignment="Left" Margin="0,3.238,0,-2.146" Width="23" Height="18" Fill="SteelBlue" Stroke="Black" RenderTransformOrigin="0.5,0.62">
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform AngleY="0" AngleX="-23"/>
<RotateTransform Angle="123"/>
<TranslateTransform/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
<Rectangle Fill="{TemplateBinding Background}" Stroke="black" RadiusX="5" RadiusY="5"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="0" TextBlock.FontFamily="Segoe UI" TextBlock.FontWeight="Bold" TextBlock.Foreground="Black" >
</ContentPresenter>
</Grid>
</StackPanel>
</Grid>
</ControlTemplate>
</UserControl.Resources>
So now the trick is to figure out how to get access to this template in winforms...
Well, the UserControl is hosted in my Winforms application through the use of the
WPF Interoperability control. It, like your textboxes and labels and panels is one of the controls available in you toolbox once you have added a reference to
WindowsFOrmsIntegration and the
Microsoft.Maps.MapControl.WPF. To get those you need to download and install the WPF Map SDK that you get from here...
https://msdn.microsoft.com/en-us/library/hh750210.aspx?f=255&MSPPError=-2147217396
When you add the
WPF Interoperability control you get a chance to add the WPF control you've built.
You can now access the template within that control as follows
Dim NewPushpin As System.Windows.Controls.ControlTemplate = BingMapUC.FindResource("MyNewPushpin")
Then instantiate and present your pushpin(s) in code
Dim Pin As New Pushpin
Pin.Location = New Location(Latitude, Longitude)
Pin.Content = "a pin"
Pin.Name = "Pin_" & Counter
Pin.Template = NewPushpin
Pin.Background = Windows.Media.Brushes.YellowGreen
MyBingMapUC.Map.Center = Pin.Location
MyBingMapUC.Map.ZoomLevel = STATE_VIEW
MyBingMapUC.Map.Children.Add(Pin)
In my template I exposed the Pushpin background so it can be changed as necessary. This gave me some flexibility I needed.
If you don't know how to put together a WPF usercontrol for use on a winform there's a decent tutorial here:
https://blogs.msdn.microsoft.com/rbrundritt/2013/11/08/using-bing-maps-in-winforms/