44using System ;
55using System . ComponentModel ;
66using System . Globalization ;
7+ //using System.Runtime.Remoting.Messaging;
78using System . Windows ;
9+ using System . Windows . Annotations ;
10+ using System . Windows . Automation . Peers ;
811using System . Windows . Controls ;
912using System . Windows . Data ;
1013using System . Windows . Markup ;
@@ -39,14 +42,20 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
3942 /// <summary>
4043 /// 可编辑标签元素的类型
4144 /// </summary>
42- public enum EditorType
45+ internal enum EditorType
4346 {
4447 TextBox ,
4548 TextBlock ,
4649 NumericUpDown ,
4750 Other ,
4851 }
4952
53+ public enum HeaderAligment
54+ {
55+ Left ,
56+ Top ,
57+ }
58+
5059 /// <summary>
5160 /// 可编辑标签
5261 /// </summary>
@@ -73,6 +82,36 @@ private bool IsInDesignMode
7382 }
7483
7584
85+ /// <summary>
86+ /// <see cref="EditingTag"/>内容类型,<see cref="EditorType"/>默认为<see cref="TextBox"/>
87+ /// </summary>
88+ internal EditorType EditorType
89+ {
90+ get { return ( EditorType ) GetValue ( EditorTypeProperty ) ; }
91+ set { SetValue ( EditorTypeProperty , value ) ; }
92+ }
93+ /// <summary>
94+ /// 提供<see cref="EditorType"/>的依赖属性
95+ /// </summary>
96+ public static readonly DependencyProperty EditorTypeProperty =
97+ DependencyProperty . Register ( "EditorType" , typeof ( EditorType ) , typeof ( EditingTag ) , new PropertyMetadata ( default ( EditorType ) , OnPropertiesChanged ) ) ;
98+
99+
100+ /// <summary>
101+ /// 标头位置,上或者左
102+ /// </summary>
103+ public HeaderAligment Aligment
104+ {
105+ get => ( HeaderAligment ) GetValue ( AligmentProperty ) ;
106+ set => SetValue ( AligmentProperty , value ) ;
107+ }
108+ /// <summary>
109+ /// 提供<see cref="Aligment"/>的依赖属性
110+ /// </summary>
111+ public static readonly DependencyProperty AligmentProperty =
112+ DependencyProperty . Register ( "Aligment" , typeof ( HeaderAligment ) , typeof ( EditingTag ) , new PropertyMetadata ( default ( HeaderAligment ) ) ) ;
113+
114+
76115 /// <summary>
77116 /// 标签头的宽度
78117 /// </summary>
@@ -88,6 +127,21 @@ public GridLength HeaderWidth
88127 DependencyProperty . Register ( "HeaderWidth" , typeof ( GridLength ) , typeof ( EditingTag ) , new PropertyMetadata ( GridLength . Auto , OnPropertiesChanged ) ) ;
89128
90129
130+ /// <summary>
131+ /// 标签头的高度
132+ /// </summary>
133+ public GridLength HeaderHeight
134+ {
135+ get => ( GridLength ) GetValue ( HeaderHeightProperty ) ;
136+ set => SetValue ( HeaderHeightProperty , value ) ;
137+ }
138+ /// <summary>
139+ /// 提供<see cref="HeaderHeight"/>的依赖属性
140+ /// </summary>
141+ public static readonly DependencyProperty HeaderHeightProperty =
142+ DependencyProperty . Register ( "HeaderHeight" , typeof ( GridLength ) , typeof ( EditingTag ) , new PropertyMetadata ( GridLength . Auto , OnPropertiesChanged ) ) ;
143+
144+
91145 /// <summary>
92146 /// 标签头的水平定位
93147 /// </summary>
@@ -100,7 +154,7 @@ public HorizontalAlignment HeaderHorizontalAlignment
100154 /// 提供<see cref="HeaderHorizontalAlignment"/>的依赖属性
101155 /// </summary>
102156 public static readonly DependencyProperty HeaderHorizontalAlignmentProperty =
103- DependencyProperty . Register ( "HeaderHorizontalAlignment" , typeof ( HorizontalAlignment ) , typeof ( EditingTag ) , new PropertyMetadata ( default ( HorizontalAlignment ) , OnPropertiesChanged ) ) ;
157+ DependencyProperty . Register ( "HeaderHorizontalAlignment" , typeof ( HorizontalAlignment ) , typeof ( EditingTag ) , new PropertyMetadata ( HorizontalAlignment . Right , OnPropertiesChanged ) ) ;
104158
105159
106160 /// <summary>
@@ -118,20 +172,6 @@ public VerticalAlignment HeaderVerticalAlignment
118172 DependencyProperty . Register ( "HeaderVerticalAlignment" , typeof ( VerticalAlignment ) , typeof ( EditingTag ) , new PropertyMetadata ( default ( VerticalAlignment ) , OnPropertiesChanged ) ) ;
119173
120174
121- /// <summary>
122- /// <see cref="EditingTag"/>内容类型,<see cref="EditorType"/>默认为<see cref="TextBox"/>
123- /// </summary>
124- public EditorType EditorType
125- {
126- get { return ( EditorType ) GetValue ( EditorTypeProperty ) ; }
127- set { SetValue ( EditorTypeProperty , value ) ; }
128- }
129- /// <summary>
130- /// 提供<see cref="EditorType"/>的依赖属性
131- /// </summary>
132- public static readonly DependencyProperty EditorTypeProperty =
133- DependencyProperty . Register ( "EditorType" , typeof ( EditorType ) , typeof ( EditingTag ) , new PropertyMetadata ( default ( EditorType ) , OnPropertiesChanged ) ) ;
134-
135175 /// <summary>
136176 /// 标签头与内容间距
137177 /// </summary>
@@ -144,7 +184,7 @@ public Thickness HeaderMargin
144184 /// 表示<see cref="HeaderMargin"/>的依赖属性
145185 /// </summary>
146186 public static readonly DependencyProperty HeaderMarginProperty =
147- DependencyProperty . Register ( "HeaderMargin" , typeof ( Thickness ) , typeof ( EditingTag ) , new PropertyMetadata ( default ( Thickness ) , OnPropertiesChanged ) ) ;
187+ DependencyProperty . Register ( "HeaderMargin" , typeof ( Thickness ) , typeof ( EditingTag ) , new PropertyMetadata ( new Thickness ( 0 , 0 , 6 , 0 ) , OnPropertiesChanged ) ) ;
148188
149189
150190 private static void OnPropertiesChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
0 commit comments