using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; namespace FWindSoft.Wpf.Controls { public class LabelEditor: HeaderedContentControl { public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(LabelEditor), new PropertyMetadata(Orientation.Horizontal)); public static readonly DependencyProperty LabelWidthProperty = DependencyProperty.Register("LabelWidth", typeof(double), typeof(LabelEditor), new PropertyMetadata(0d)); public static readonly DependencyProperty LabelHeightProperty = DependencyProperty.Register(" LabelHeight", typeof(double), typeof(LabelEditor), new PropertyMetadata(0d)); public static readonly DependencyProperty LabelHorizontalAlignmentProperty = DependencyProperty.Register(" LabelHorizontalAlignment", typeof(HorizontalAlignment), typeof(LabelEditor), new PropertyMetadata(HorizontalAlignment.Right)); static LabelEditor() { DefaultStyleKeyProperty.OverrideMetadata(typeof(LabelEditor), new FrameworkPropertyMetadata(typeof(LabelEditor))); } public LabelEditor() { this.HorizontalContentAlignment = HorizontalAlignment.Stretch; this.VerticalContentAlignment = VerticalAlignment.Stretch; } #region 依赖属性 /// /// 关联显示属性集合 /// public Orientation Orientation { get { return (Orientation)GetValue(OrientationProperty); } set { SetValue(OrientationProperty, value); } } /// /// 标签宽度 /// public Double LabelWidth { get { return (double)GetValue(LabelWidthProperty); } set { SetValue(LabelWidthProperty, value); } } /// /// 变迁高度 /// public Double LabelHeight { get { return (double)GetValue(LabelHeightProperty); } set { SetValue(LabelHeightProperty, value); } } public HorizontalAlignment LabelHorizontalAlignment { get { return (HorizontalAlignment)GetValue(LabelHorizontalAlignmentProperty); } set { SetValue(LabelHorizontalAlignmentProperty, value); } } #endregion } }