1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-31 01:42:02 +00:00

Color gradient property - Trigger PropertyChanged on data binding update

This commit is contained in:
Robert 2021-03-04 20:02:07 +01:00
parent ef66511564
commit 6ba3e6941d

View File

@ -26,12 +26,14 @@ namespace Artemis.Core
for (int index = 0; index < CurrentValue.Stops.Count; index++) for (int index = 0; index < CurrentValue.Stops.Count; index++)
{ {
int stopIndex = index; int stopIndex = index;
RegisterDataBindingProperty(
() => CurrentValue.Stops[stopIndex].Color, void Setter(SKColor value)
value => CurrentValue.Stops[stopIndex].Color = value, {
new ColorStopDataBindingConverter(), CurrentValue.Stops[stopIndex].Color = value;
$"Color #{stopIndex + 1}" CurrentValue.OnColorValuesUpdated();
); }
RegisterDataBindingProperty(() => CurrentValue.Stops[stopIndex].Color, Setter, new ColorStopDataBindingConverter(), $"Color #{stopIndex + 1}");
} }
} }
@ -58,12 +60,12 @@ namespace Artemis.Core
if (_subscribedGradient != BaseValue) if (_subscribedGradient != BaseValue)
{ {
if (_subscribedGradient != null) if (_subscribedGradient != null)
_subscribedGradient.PropertyChanged -= SubscribedGradientOnPropertyChanged; _subscribedGradient.PropertyChanged -= SubscribedGradientOnPropertyChanged;
_subscribedGradient = BaseValue; _subscribedGradient = BaseValue;
_subscribedGradient.PropertyChanged += SubscribedGradientOnPropertyChanged; _subscribedGradient.PropertyChanged += SubscribedGradientOnPropertyChanged;
} }
CreateDataBindingRegistrations(); CreateDataBindingRegistrations();
} }