wpf之圆角按钮样式

添加按钮的圆角属性:

namespace XXXXX
{
    class BorderRadiusButton :System.Windows.Controls.Button
    {
        #region 属性
        //圆角
        public int BorderRadius

        {
            get { return (int)GetValue(BorderRadiusProperty); }

            set { SetValue(BorderRadiusProperty, value); }
        }

        public static readonly System.Windows.DependencyProperty BorderRadiusProperty = System.Windows.DependencyProperty.Register("BorderRadius", typeof(int), typeof(BorderRadiusButton), new System.Windows.FrameworkPropertyMetadata());

        #endregion 属性
    }
}

添加引用:

xmlns:radiusButton ="clr-namespace:XXXXX"

添加样式:


        
    

应用:背景颜色为#35A3DD,圆角弧度5,边缘线宽度0,字体颜色白色

        归零

 

你可能感兴趣的:(.NET,-----,WPF,控件样式)