1
我想創建一個DependencyProperty,其中包含兩個選項(左和右),類似於TextBlock中的LeftAlignment屬性。Custom DependencyProperty
有誰知道與此相關的代碼?我迄今只創造瞭如下簡單DependencyPropertys:
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); }
}