I want to create a DependencyProperty with 2 options (Left and Right) similar to properties like LeftAlignment in a TextBlock.
Does anyone know the code associated with this? I have so far only created simple DependencyPropertys as below:
public static readonly DependencyProperty AlignProperty = DependencyProperty.Register("Align", typeof(string), typeof(HalfCurvedRectangle), new FrameworkPropertyMetadata("Left", FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure));
[TypeConverter(typeof(StringConverter))]
public string Align
{
get { return (string)base.GetValue(AlignProperty); }
set { base.SetValue(AlignProperty, value); }
}
Simply set the type of the property to an enum type instead of string for example: