From 195fb6df3b57a0f43b5ca08452590adc538ae19d Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 9 Dec 2015 20:15:20 +0100 Subject: [PATCH] Renamed OnDataContextFinishedChanging To OnDataContextChanged and added DataContextChanged event. --- src/Perspex.Controls/Control.cs | 14 ++++++++++++-- .../Primitives/SelectingItemsControl.cs | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Perspex.Controls/Control.cs b/src/Perspex.Controls/Control.cs index 25cabadb0a..ad959d7f8e 100644 --- a/src/Perspex.Controls/Control.cs +++ b/src/Perspex.Controls/Control.cs @@ -93,6 +93,15 @@ namespace Perspex.Controls _nameScope = this as INameScope; } + /// + /// Occurs when the property changes. + /// + /// + /// This event will be raised when the property has changed and + /// all subscribers to that change have been notified. + /// + public event EventHandler DataContextChanged; + /// /// Gets or sets the control's classes. /// @@ -394,8 +403,9 @@ namespace Perspex.Controls /// Called when the is changed and all subscribers to that change /// have been notified. /// - protected virtual void OnDataContextFinishedChanging() + protected virtual void OnDataContextChanged() { + DataContextChanged?.Invoke(this, EventArgs.Empty); } /// @@ -422,7 +432,7 @@ namespace Perspex.Controls if (!notifying) { - control.OnDataContextFinishedChanging(); + control.OnDataContextChanged(); } } } diff --git a/src/Perspex.Controls/Primitives/SelectingItemsControl.cs b/src/Perspex.Controls/Primitives/SelectingItemsControl.cs index 42886a0f41..b60af28fda 100644 --- a/src/Perspex.Controls/Primitives/SelectingItemsControl.cs +++ b/src/Perspex.Controls/Primitives/SelectingItemsControl.cs @@ -287,7 +287,7 @@ namespace Perspex.Controls.Primitives } /// - protected override void OnDataContextFinishedChanging() + protected override void OnDataContextChanged() { if (_clearSelectedItemsAfterDataContextChanged == SelectedItems) {