1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +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++)
{
int stopIndex = index;
RegisterDataBindingProperty(
() => CurrentValue.Stops[stopIndex].Color,
value => CurrentValue.Stops[stopIndex].Color = value,
new ColorStopDataBindingConverter(),
$"Color #{stopIndex + 1}"
);
void Setter(SKColor value)
{
CurrentValue.Stops[stopIndex].Color = value;
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 != null)
if (_subscribedGradient != null)
_subscribedGradient.PropertyChanged -= SubscribedGradientOnPropertyChanged;
_subscribedGradient = BaseValue;
_subscribedGradient.PropertyChanged += SubscribedGradientOnPropertyChanged;
}
CreateDataBindingRegistrations();
}