diff --git a/src/Perspex.Base/PriorityLevel.cs b/src/Perspex.Base/PriorityLevel.cs
index 0ca18e45bd..e0d096a835 100644
--- a/src/Perspex.Base/PriorityLevel.cs
+++ b/src/Perspex.Base/PriorityLevel.cs
@@ -31,34 +31,22 @@ namespace Perspex
///
internal class PriorityLevel
{
- ///
- /// Method called when current value changes.
- ///
- private readonly Action _changed;
-
- ///
- /// The current direct value.
- ///
+ private PriorityValue _owner;
private object _directValue;
-
- ///
- /// The index of the next .
- ///
private int _nextIndex;
///
/// Initializes a new instance of the class.
///
+ /// The owner.
/// The priority.
- /// The precedence mode.
- /// A method to be called when the current value changes.
public PriorityLevel(
- int priority,
- Action changed)
+ PriorityValue owner,
+ int priority)
{
- Contract.Requires(changed != null);
+ Contract.Requires(owner != null);
- _changed = changed;
+ _owner = owner;
Priority = priority;
Value = _directValue = PerspexProperty.UnsetValue;
ActiveBindingIndex = -1;
@@ -83,7 +71,7 @@ namespace Perspex
set
{
Value = _directValue = value;
- _changed(this);
+ _owner.LevelValueChanged(this);
}
}
@@ -141,7 +129,7 @@ namespace Perspex
{
Value = entry.Value;
ActiveBindingIndex = entry.Index;
- _changed(this);
+ _owner.LevelValueChanged(this);
}
else
{
@@ -175,14 +163,14 @@ namespace Perspex
{
Value = binding.Value;
ActiveBindingIndex = binding.Index;
- _changed(this);
+ _owner.LevelValueChanged(this);
return;
}
}
Value = DirectValue;
ActiveBindingIndex = -1;
- _changed(this);
+ _owner.LevelValueChanged(this);
}
}
}
diff --git a/src/Perspex.Base/PriorityValue.cs b/src/Perspex.Base/PriorityValue.cs
index 5a1ae7a4e0..50dbc5c0f7 100644
--- a/src/Perspex.Base/PriorityValue.cs
+++ b/src/Perspex.Base/PriorityValue.cs
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Reactive.Subjects;
using System.Text;
using Perspex.Logging;
using Perspex.Utilities;
@@ -21,34 +20,15 @@ namespace Perspex
/// priority binding that doesn't return . Where there
/// are multiple bindings registered with the same priority, the most recently added binding
/// has a higher priority. Each time the value changes, the
- /// method on the
+ /// method on the
/// owner object is fired with the old and new values.
///
internal class PriorityValue
{
- ///
- /// The owner of the object.
- ///
private readonly IPriorityValueOwner _owner;
-
- ///
- /// The value type.
- ///
private readonly Type _valueType;
-
- ///
- /// The currently registered bindings organised by priority.
- ///
private readonly Dictionary _levels = new Dictionary();
-
- ///
- /// The current value.
- ///
private object _value;
-
- ///
- /// The function used to validate the value, if any.
- ///
private readonly Func