aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-01-29 18:45:10 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-01-29 18:45:10 +0200
commit5cda8b0a3ab579dd6f33b1cb19a1d295dc661d28 (patch)
treeef9408ca50840d407f3c62bbcd19147739fde145 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters
parent7e8ff4c3ca798d426eb6f381c5312a747f1bb800 (diff)
downloadTango-5cda8b0a3ab579dd6f33b1cb19a1d295dc661d28.tar.gz
Tango-5cda8b0a3ab579dd6f33b1cb19a1d295dc661d28.zip
Added gradient display of color Brush Stops.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToGradientStopsConverter.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToGradientStopsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToGradientStopsConverter.cs
new file mode 100644
index 000000000..1588b7740
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToGradientStopsConverter.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+using System.Windows.Media;
+using Tango.DAL.Observables;
+
+namespace Tango.MachineStudio.Developer.Converters
+{
+ public class SegmentToGradientStopsConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ try
+ {
+ Segment segment = value as Segment;
+
+ GradientStopCollection stops = new GradientStopCollection();
+
+ foreach (var stop in segment.BrushStops)
+ {
+ stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d));
+ }
+
+ return stops;
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}