How can I set the color of a pushpin programmatically through C# rather than XAML? How can I set font and size of a string associated with a pushpin through Content property? I'm not sure how to use ContentStringFormat property to achieve this.
Asked
Active
Viewed 3,098 times
1 Answers
4
pushpin.Background = new SolidColorBrush(Color.FromArgb(100,100,100,100));
Pushpin has inherited FontFamily and FontSize properties, they should have effect on the associated text.
pushpin.FontFamily = new FontFamily("Arial");
pushpin.FontSize = 20.0;

kennyzx
- 12,845
- 6
- 39
- 83
-
Thank you. Do you also know how I can change size of a pushpin? I tried changing Height and Width properties, but pushpin's size never changed. Also, how can I change pushpin's shape/icon into some other standard shape/icon provided by WPF? Or do I have to provide an image myself and make it my pushpin's icon? – user3623874 Oct 29 '14 at 08:19
-
You need to provide a `ControlTemplate` for the pushpin, it is in XAML - why do you prefer code over XAML? - fortunately there is already [an example](http://stackoverflow.com/a/14559818/815938) – kennyzx Oct 29 '14 at 08:38