Index: src/DeltaShell/DeltaShell.Gui/Forms/PropertyGridView/PropertyGridView.cs =================================================================== diff -u -re4b61e9c937804cf36c21cd4b976559298281063 -rb96820752850219c096ba6efbf6e32fcbb4df9a6 --- src/DeltaShell/DeltaShell.Gui/Forms/PropertyGridView/PropertyGridView.cs (.../PropertyGridView.cs) (revision e4b61e9c937804cf36c21cd4b976559298281063) +++ src/DeltaShell/DeltaShell.Gui/Forms/PropertyGridView/PropertyGridView.cs (.../PropertyGridView.cs) (revision b96820752850219c096ba6efbf6e32fcbb4df9a6) @@ -34,9 +34,10 @@ HideTabsButton(); FixDescriptionArea(); - this.gui = gui; PropertySort = PropertySort.Categorized; + this.gui = gui; + gui.SelectionChanged += GuiSelectionChanged; } @@ -53,10 +54,6 @@ } } - /// - /// Raises the event. - /// - /// A that contains the event data. protected override void OnPropertySortChanged(EventArgs e) { // Needed for maintaining property order @@ -136,19 +133,14 @@ public object GetObjectProperties(object sourceData) { - if (gui != null) - { - return PropertyResolver.GetObjectProperties(gui.Plugins.SelectMany(p => p.GetPropertyInfos()).ToList(), sourceData); - } - - return null; + return gui != null ? PropertyResolver.GetObjectProperties(gui.Plugins.SelectMany(p => p.GetPropertyInfos()).ToList(), sourceData) : null; } public ViewInfo ViewInfo { get; set; } #endregion - #region Enable tab key navigation on property grid + #region Tab key navigation /// /// Do special processing for Tab key. @@ -230,7 +222,7 @@ #endregion - #region PropertyGrid tweaks + #region Visualization tweaks /// /// Removes the redundant "tabs" toolstrip button and its corresponding separator. Index: src/DeltaShell/DeltaShell.Gui/Forms/PropertyGridView/PropertyResolver.cs =================================================================== diff -u -rca1cac04629e881bb7a6d225ea7f286071247da5 -rb96820752850219c096ba6efbf6e32fcbb4df9a6 --- src/DeltaShell/DeltaShell.Gui/Forms/PropertyGridView/PropertyResolver.cs (.../PropertyResolver.cs) (revision ca1cac04629e881bb7a6d225ea7f286071247da5) +++ src/DeltaShell/DeltaShell.Gui/Forms/PropertyGridView/PropertyResolver.cs (.../PropertyResolver.cs) (revision b96820752850219c096ba6efbf6e32fcbb4df9a6) @@ -7,16 +7,16 @@ namespace DeltaShell.Gui.Forms.PropertyGridView { /// - /// Helper class for resolving objects. + /// Helper class for resolving object properties. /// public static class PropertyResolver { /// /// Returns object properties based on the provided and . /// - /// The list of property info objects to obtain the object properties from. + /// The list of property information objects to obtain the object properties from. /// The source data to get the object properties for. - /// An object properties object, or null when no relevant propwrties object is found. + /// An object properties object, or null when no relevant properties object is found. public static object GetObjectProperties(List propertyInfos, object sourceData) { if (sourceData == null) @@ -93,12 +93,12 @@ var objectProperties = propertyInfo.CreateObjectProperties(sourceData); // Return a dynamic property bag containing the created object properties - return new DynamicPropertyBag(objectProperties); + return new DynamicPropertyBag(objectProperties); } catch (Exception) { return null; } } } -} +} \ No newline at end of file Index: test/DeltaShell/DeltaShell.Tests/Gui/Forms/PropertyGridView/PropertyResolverTest.cs =================================================================== diff -u -r85d5712c3ec4d26c9a9869fe9d34a57479d4157c -rb96820752850219c096ba6efbf6e32fcbb4df9a6 --- test/DeltaShell/DeltaShell.Tests/Gui/Forms/PropertyGridView/PropertyResolverTest.cs (.../PropertyResolverTest.cs) (revision 85d5712c3ec4d26c9a9869fe9d34a57479d4157c) +++ test/DeltaShell/DeltaShell.Tests/Gui/Forms/PropertyGridView/PropertyResolverTest.cs (.../PropertyResolverTest.cs) (revision b96820752850219c096ba6efbf6e32fcbb4df9a6) @@ -64,11 +64,11 @@ { AdditionalDataCheck = o => false }, - new PropertyInfo>() // specifically for C + new PropertyInfo>() }; // Call - var objectProperties = PropertyResolver.GetObjectProperties(propertyInfos, new C()); //we ask for C + var objectProperties = PropertyResolver.GetObjectProperties(propertyInfos, new C()); // Assert Assert.AreSame(typeof(SimpleProperties), @@ -88,7 +88,7 @@ // Call var objectProperties = PropertyResolver.GetObjectProperties(propertyInfos, new D()); - // Setup + // Assert Assert.IsTrue(objectProperties is DynamicPropertyBag); Assert.AreSame(typeof(SimpleProperties), ((DynamicPropertyBag) objectProperties).GetContentType()); } @@ -143,8 +143,8 @@ { new PropertyInfo> { - AdditionalDataCheck = o => true - }, // Additional data check which will be matched + AdditionalDataCheck = o => true // Additional data check which will be matched + }, new PropertyInfo>() }; @@ -164,8 +164,8 @@ { new PropertyInfo> { - AdditionalDataCheck = o => false - }, // Additional data check which will not be matched + AdditionalDataCheck = o => false // Additional data check which will not be matched + }, new PropertyInfo>() }; @@ -231,6 +231,8 @@ // Call var objectProperties = PropertyResolver.GetObjectProperties(propertyInfos, new B()); + + // Assert Assert.IsNull(objectProperties); } @@ -291,15 +293,15 @@ * */ - internal class A {} + private class A {} private class B : A {} - internal class C : A {} + private class C : A {} private class D : C {} - internal class SimpleProperties : ObjectProperties {} + private class SimpleProperties : ObjectProperties {} private class DerivedSimpleProperties : SimpleProperties {}