From 2e9d392ef91ca27bd94567dd30926a7ec9ce3321 Mon Sep 17 00:00:00 2001 From: robloo Date: Sun, 20 Mar 2022 23:07:45 -0400 Subject: [PATCH] Add new ColorChangedEventArgs --- .../ColorPicker/ColorChangedEventArgs.cs | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/Avalonia.Controls/ColorPicker/ColorChangedEventArgs.cs diff --git a/src/Avalonia.Controls/ColorPicker/ColorChangedEventArgs.cs b/src/Avalonia.Controls/ColorPicker/ColorChangedEventArgs.cs new file mode 100644 index 0000000000..93ba1a4db1 --- /dev/null +++ b/src/Avalonia.Controls/ColorPicker/ColorChangedEventArgs.cs @@ -0,0 +1,59 @@ +// Portions of this source file are adapted from the WinUI project. +// (https://github.com/microsoft/microsoft-ui-xaml) +// +// Licensed to The Avalonia Project under the MIT License. + +using System; +using Avalonia.Media; + +namespace Avalonia.Controls +{ + /// + /// Holds the details of a ColorChanged event. + /// + /// + /// HSV color information is intentionally not provided. + /// Use to obtain it. + /// + public class ColorChangedEventArgs : EventArgs + { + private Color _OldColor; + private Color _NewColor; + + /// + /// Initializes a new instance of the class. + /// + public ColorChangedEventArgs() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The old/original color from before the change event. + /// The new/updated color that triggered the change event. + public ColorChangedEventArgs(Color oldColor, Color newColor) + { + _OldColor = oldColor; + _NewColor = newColor; + } + + /// + /// Gets the old/original color from before the change event. + /// + public Color OldColor + { + get => _OldColor; + internal set => _OldColor = value; + } + + /// + /// Gets the new/updated color that triggered the change event. + /// + public Color NewColor + { + get => _NewColor; + internal set => _NewColor = value; + } + } +}