public class ImageProperty
{
//图片圆角
public static CornerRadius GetCornerRadius(DependencyObject obj)
{
return (CornerRadius)obj.GetValue(CornerRadiusProperty);
}
public static void SetCornerRadius(DependencyObject obj, CornerRadius value)
{
obj.SetValue(CornerRadiusProperty, value);
}
// Using a DependencyProperty as the backing store for CornerRadius. This enables animation, styling, binding, etc...
public static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(ImageProperty), new PropertyMetadata(new CornerRadius(0), CornerRadiusChanged));
private static void CornerRadiusChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is Image img)
{
if (img.OpacityM
wpf图片image增加圆角的附加属性写法
最新推荐文章于 2023-03-28 15:45:39 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)