Changed everything related to brushes/gradients to be correctly bindable

This commit is contained in:
DarthAffe committed 2018-01-30 20:47:14 +01:00
1 parent 84b0c5402d
commit 98331d0241
7 files changed
+87 -17

No files matched your search

@@ -2,7 +2,7 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using RGB.NET.Core;
@@ -20,14 +20,19 @@ namespace RGB.NET.Brushes.Gradients
/// <summary>
/// Gets a list of the stops used by this <see cref="AbstractGradient"/>.
/// </summary>
public IList<GradientStop> GradientStops { get; } = new List<GradientStop>();
public ObservableCollection<GradientStop> GradientStops { get; } = new ObservableCollection<GradientStop>();
private bool _wrapGradient;
/// <summary>
/// Gets or sets if the Gradient wraps around if there isn't a second stop to take.
/// Example: There is a stop at offset 0.0, 0.5 and 0.75.
/// Without wrapping offset 1.0 will be calculated the same as 0.75; with wrapping it would be the same as 0.0.
/// </summary>
public bool WrapGradient { get; set; }
public bool WrapGradient
{
get => _wrapGradient;
set => SetProperty(ref _wrapGradient, value);
}
#endregion
+13 -3
View File
@@ -8,19 +8,29 @@ namespace RGB.NET.Brushes.Gradients
/// <summary>
/// Represents a stop on a gradient.
/// </summary>
public class GradientStop
public class GradientStop : AbstractBindable
{
#region Properties & Fields
private double _offset;
/// <summary>
/// Gets or sets the percentage offset to place this <see cref="GradientStop"/>. This should be inside the range of [0..1] but it's not necessary.
/// </summary>
public double Offset { get; set; }
public double Offset
{
get => _offset;
set => SetProperty(ref _offset, value);
}
private Color _color;
/// <summary>
/// Gets or sets the <see cref="Color"/> of this <see cref="GradientStop"/>.
/// </summary>
public Color Color { get; set; }
public Color Color
{
get => _color;
set => SetProperty(ref _color, value);
}
#endregion
+12 -2
View File
@@ -15,15 +15,25 @@ namespace RGB.NET.Brushes.Gradients
{
#region Properties & Fields
private double _startHue;
/// <summary>
/// Gets or sets the hue (in degrees) to start from.
/// </summary>
public double StartHue { get; set; }
public double StartHue
{
get => _startHue;
set => SetProperty(ref _startHue, value);
}
private double _endHue;
/// <summary>
/// Gets or sets the hue (in degrees) to end the with.
/// </summary>
public double EndHue { get; set; }
public double EndHue
{
get => _endHue;
set => SetProperty(ref _endHue, value);
}
#endregion