aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/MaterialDesignInXamlToolkit-master/MaterialDesignThemes.Wpf/Converters/BrushToRadialGradientBrushConverter.cs
blob: 52be9245aea99992999c55c223da8c4444d20dbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;

namespace MaterialDesignThemes.Wpf.Converters
{
	public class BrushToRadialGradientBrushConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			var solidColorBrush = value as SolidColorBrush;
			if (solidColorBrush == null) return Binding.DoNothing;

			return new RadialGradientBrush(solidColorBrush.Color, Colors.Transparent)
			{
				Center = new Point(.5, .5),
				GradientOrigin = new Point(.5, .5),
				RadiusX = .75,
				RadiusY = .75,
				Opacity = .39
			};
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			return Binding.DoNothing;
		}
	}
}