mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-20 00:16:36 +08:00
27 lines
800 B
C#
27 lines
800 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
using System.Windows.Media;
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
|
{
|
|
public class BrushOpacityConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is SolidColorBrush brush)
|
|
{
|
|
var opacity = System.Convert.ToDouble(parameter, CultureInfo.InvariantCulture);
|
|
return new SolidColorBrush(brush.Color)
|
|
{
|
|
Opacity = opacity
|
|
};
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
=> Binding.DoNothing;
|
|
}
|
|
}
|