From a4b12df7c184b5036ff6e9cb8df025756227cfb8 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 13 Dec 2014 18:10:59 +0100 Subject: [PATCH] Update property values in DevTools. --- Perspex.Diagnostics/DevTools.cs | 2 +- Perspex.Diagnostics/ViewModels/PropertyDetails.cs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Perspex.Diagnostics/DevTools.cs b/Perspex.Diagnostics/DevTools.cs index d5c7d4d66a..38abb63506 100644 --- a/Perspex.Diagnostics/DevTools.cs +++ b/Perspex.Diagnostics/DevTools.cs @@ -118,7 +118,7 @@ namespace Perspex.Diagnostics Children = new Controls { new TextBlock { Text = x.Name }, - new TextBlock { Text = Convert.ToString(x.Value) }, + new TextBlock { [!TextBlock.TextProperty] = x.WhenAnyValue(v => v.Value).Select(v => v.ToString()) }, new TextBlock { Text = x.Priority }, }, }), diff --git a/Perspex.Diagnostics/ViewModels/PropertyDetails.cs b/Perspex.Diagnostics/ViewModels/PropertyDetails.cs index 3fd5b355dd..6e71ced72a 100644 --- a/Perspex.Diagnostics/ViewModels/PropertyDetails.cs +++ b/Perspex.Diagnostics/ViewModels/PropertyDetails.cs @@ -11,13 +11,20 @@ namespace Perspex.Diagnostics.ViewModels internal class PropertyDetails : ReactiveObject { + private object value; + public PropertyDetails(PerspexPropertyValue value) { this.Name = value.Property.Name; - this.Value = value.CurrentValue ?? "(null)"; + this.value = value.CurrentValue ?? "(null)"; this.Priority = (value.PriorityValue != null) ? Enum.GetName(typeof(BindingPriority), value.PriorityValue.ValuePriority) : value.Property.Inherits ? "Inherited" : "Unset"; + + if (value.PriorityValue != null) + { + value.PriorityValue.Changed.Subscribe(x => this.Value = x.Item2); + } } public string Name @@ -28,8 +35,8 @@ namespace Perspex.Diagnostics.ViewModels public object Value { - get; - private set; + get { return this.value; } + private set { this.RaiseAndSetIfChanged(ref this.value, value); } } public string Priority