wpf 自定义属性的默认值


public int MaxSelectCount
{
get { return (int)GetValue(MaxSelectCountProperty); }
set { SetValue(MaxSelectCountProperty, value);
txtMaxCount.Text = value.ToString(); }
}

//200默认值
public static readonly DependencyProperty MaxSelectCountProperty = DependencyProperty.RegisterAttached("MaxSelectCount", typeof(int), typeof(HzPostionListGroupSelect), new FrameworkPropertyMetadata(200));

原文地址:https://www.cnblogs.com/zsx-blog/p/8918680.html