public class MyTextSymbol : MarkerSymbol { public MyTextSymbol() { TextSymbol textSymbol = new TextSymbol(); this.ControlTemplate = textSymbol.ControlTemplate; this.FontFamily = new FontFamily("Arial"); this.FontSize = 12; this.FontStyle = FontStyles.Normal; this.FontWeight = FontWeights.Normal; this.TextDecorations = null; } public String Text { get { return GetValue(TextProperty) as String; } set { SetValue(TextProperty, value); } } /// <summary> /// Identifies the <see cref="Text"/> dependency property. /// </summary> public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(String), typeof(MyTextSymbol), new PropertyMetadata(OnTextPropertyChanged)); private static void OnTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { String text = e.NewValue as String; } public Double? FontSize { get { return GetValue(FontSizeProperty) as Double?; } set { SetValue(FontSizeProperty, value); } } /// <summary> /// Identifies the <see cref="FontSize"/> dependency property. /// </summary> public static readonly DependencyProperty FontSizeProperty = DependencyProperty.Register("FontSize", typeof(Double), typeof(MyTextSymbol), new PropertyMetadata(OnFontSizePropertyChanged)); private static void OnFontSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Double? fontSize = e.NewValue as Double?; } public FontFamily FontFamily { get { return GetValue(FontFamilyProperty) as FontFamily; } set { SetValue(FontFamilyProperty, value); } } /// <summary> /// Identifies the <see cref="FontFamily"/> dependency property. /// </summary> public static readonly DependencyProperty FontFamilyProperty = DependencyProperty.Register("FontFamily", typeof(FontFamily), typeof(MyTextSymbol), new PropertyMetadata(OnFontFamilyPropertyChanged)); private static void OnFontFamilyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FontFamily fontFamily = e.NewValue as FontFamily; } public FontStyle? FontStyle { get { return GetValue(FontStyleProperty) as FontStyle?; } set { SetValue(FontStyleProperty, value); } } /// <summary> /// Identifies the <see cref="FontStyle"/> dependency property. /// </summary> public static readonly DependencyProperty FontStyleProperty = DependencyProperty.Register("FontStyle", typeof(FontStyle), typeof(MyTextSymbol), new PropertyMetadata(OnFontStylePropertyChanged)); private static void OnFontStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FontStyle? fontStyle = e.NewValue as FontStyle?; } public FontWeight? FontWeight { get { return GetValue(FontWeightProperty) as FontWeight?; } set { SetValue(FontWeightProperty, value); } } /// <summary> /// Identifies the <see cref="FontWeight"/> dependency property. /// </summary> public static readonly DependencyProperty FontWeightProperty = DependencyProperty.Register("FontWeight", typeof(FontWeight), typeof(MyTextSymbol), new PropertyMetadata(OnFontWeightPropertyChanged)); private static void OnFontWeightPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { FontWeight? fontWeight = e.NewValue as FontWeight?; } public TextDecorationCollection TextDecorations { get { return GetValue(TextDecorationsProperty) as TextDecorationCollection; } set { SetValue(TextDecorationsProperty, value); } } /// <summary> /// Identifies the <see cref="TextDecorations"/> dependency property. /// </summary> public static readonly DependencyProperty TextDecorationsProperty = DependencyProperty.Register("TextDecorations", typeof(TextDecorationCollection), typeof(MyTextSymbol), new PropertyMetadata(OnTextDecorationsPropertyChanged)); private static void OnTextDecorationsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TextDecorationCollection textDecorations = e.NewValue as TextDecorationCollection; } }
Solved! Go to Solution.