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; } }