-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added property change propagation notification for CompositionO…
…bjects
- Loading branch information
1 parent
10f2466
commit 543b834
Showing
14 changed files
with
528 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,22 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Uno.Disposables; | ||
using Windows.UI; | ||
|
||
namespace Windows.UI.Composition | ||
{ | ||
public partial class CompositionColorBrush : CompositionBrush | ||
{ | ||
private List<Action> _colorChangedHandlers = new List<Action>(); | ||
private Color _color; | ||
|
||
internal CompositionColorBrush() => throw new NotSupportedException(); | ||
|
||
public CompositionColorBrush(Compositor compositor) : base(compositor) | ||
internal CompositionColorBrush(Compositor compositor) : base(compositor) | ||
{ | ||
|
||
} | ||
|
||
public Color Color | ||
{ | ||
get { return _color; } | ||
set { _color = value; OnColorChanged(); } | ||
} | ||
|
||
private void OnColorChanged() | ||
{ | ||
foreach (var handler in _colorChangedHandlers) | ||
{ | ||
handler(); | ||
} | ||
} | ||
|
||
internal IDisposable RegisterColorChanged(Action onColorChanged) | ||
{ | ||
_colorChangedHandlers.Add(onColorChanged); | ||
|
||
return Disposable.Create(() => _colorChangedHandlers.Remove(onColorChanged)); | ||
set { SetProperty(ref _color, value); } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.