# HG changeset patch # User Steven Hollidge # Date 1335189264 -3600 # Node ID 96e6fbd70f49e3f296bcbdb102b07126655319d2 # Parent 39ba36cc82c5c2f50a8f042fb52960172ea2acad Latest version diff -r 39ba36cc82c5 -r 96e6fbd70f49 SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs --- a/SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs Mon Apr 23 11:06:29 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse.Test/MainPage.xaml.cs Mon Apr 23 14:54:24 2012 +0100 @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; diff -r 39ba36cc82c5 -r 96e6fbd70f49 SilverlightGlimpse/SilverlightGlimpse.sln --- a/SilverlightGlimpse/SilverlightGlimpse.sln Mon Apr 23 11:06:29 2012 +0100 +++ b/SilverlightGlimpse/SilverlightGlimpse.sln Mon Apr 23 14:54:24 2012 +0100 @@ -18,9 +18,11 @@ {BB51026B-2864-4389-AACA-0BBDF1926E46}.Release|Any CPU.ActiveCfg = Release|Any CPU {BB51026B-2864-4389-AACA-0BBDF1926E46}.Release|Any CPU.Build.0 = Release|Any CPU {212DBD25-6C98-45EB-9974-51D04D8B6549}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {212DBD25-6C98-45EB-9974-51D04D8B6549}.Debug|Any CPU.Build.0 = Debug|Any CPU {212DBD25-6C98-45EB-9974-51D04D8B6549}.Release|Any CPU.ActiveCfg = Release|Any CPU {212DBD25-6C98-45EB-9974-51D04D8B6549}.Release|Any CPU.Build.0 = Release|Any CPU {0C1CC1FC-915A-4428-8952-CDC79EABC3F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C1CC1FC-915A-4428-8952-CDC79EABC3F4}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C1CC1FC-915A-4428-8952-CDC79EABC3F4}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C1CC1FC-915A-4428-8952-CDC79EABC3F4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection diff -r 39ba36cc82c5 -r 96e6fbd70f49 SilverlightGlimpse/SilverlightGlimpse/Controls/BrokenBindingsViewer.xaml --- a/SilverlightGlimpse/SilverlightGlimpse/Controls/BrokenBindingsViewer.xaml Mon Apr 23 11:06:29 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 39ba36cc82c5 -r 96e6fbd70f49 SilverlightGlimpse/SilverlightGlimpse/Controls/BrokenBindingsViewer.xaml.cs --- a/SilverlightGlimpse/SilverlightGlimpse/Controls/BrokenBindingsViewer.xaml.cs Mon Apr 23 11:06:29 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -using System.Diagnostics; -using System.Reflection; -using System.Windows; -using System.Windows.Media; -using SilverlightGlimpse.Models; -using SilverlightGlimpse.Services; - -namespace SilverlightGlimpse.Controls -{ - public partial class BrokenBindingsViewer - { - public BrokenBindingsViewer() - { - InitializeComponent(); - } - - private void BrokenBindings_Loaded(object sender, RoutedEventArgs e) - { - lbBindings.Items.Clear(); - LoadBrokenBindings(Glimpse.Service.RootVisual); - } - - private void LoadBrokenBindings(UIElement uiElement) - { - var frameworkElement = uiElement as FrameworkElement; - if (frameworkElement == null) return; - - foreach (var fieldInfo in frameworkElement.GetType().GetFields(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.Static)) - { - if (!ReferenceEquals(fieldInfo.FieldType, typeof (DependencyProperty))) continue; - - var bindingExpression = frameworkElement.GetBindingExpression((DependencyProperty)fieldInfo.GetValue(null)); - - if (bindingExpression == null || bindingExpression.ParentBinding.Source != null || - bindingExpression.ParentBinding.RelativeSource != null) continue; - - var isInherited = false; - - if (frameworkElement.DataContext != null && !string.IsNullOrEmpty(bindingExpression.ParentBinding.Path.Path)) - { - foreach (var propertyInfo in frameworkElement.DataContext.GetType().GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Static | BindingFlags.Instance)) - { - if (string.Compare(propertyInfo.Name, bindingExpression.ParentBinding.Path.Path) == 0) - { - isInherited = true; - break; - } - } - } - - if (isInherited) - { - break; - } - - //this code handles empty bindings on the Button controls - //I'll have to look into why the Button has an empty or unresolved binding - if (string.IsNullOrEmpty(frameworkElement.Name) - && frameworkElement.GetType().Name == "TextBlock" - && fieldInfo.Name == "TextProperty" - && string.IsNullOrEmpty(bindingExpression.ParentBinding.Path.Path)) - { - break; - } - - var brokenBinding = new BrokenBinding( - frameworkElement.Name, - frameworkElement.GetType().Name, - fieldInfo.Name, - bindingExpression.ParentBinding.Path.Path); - - lbBindings.Items.Add(brokenBinding); - Debug.WriteLine("Broken Binding: {0}", brokenBinding); - } - - int children = VisualTreeHelper.GetChildrenCount(frameworkElement); - - for (int j = 0; j <= children - 1; j++) - { - var child = VisualTreeHelper.GetChild(frameworkElement, j) as FrameworkElement; - - if (child != null) - { - LoadBrokenBindings(child); - } - } - } - } -} \ No newline at end of file diff -r 39ba36cc82c5 -r 96e6fbd70f49 SilverlightGlimpse/SilverlightGlimpse/Controls/ExceptionsViewer.xaml --- a/SilverlightGlimpse/SilverlightGlimpse/Controls/ExceptionsViewer.xaml Mon Apr 23 11:06:29 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - -