diff --git a/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyGrid.cs b/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyGrid.cs index eafa0b213..b31509c0e 100644 --- a/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyGrid.cs +++ b/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyGrid.cs @@ -126,7 +126,7 @@ private void UpdateItems(object obj) { if (obj == null || _itemsControl == null) return; - _dataView = CollectionViewSource.GetDefaultView(TypeDescriptor.GetProperties(obj).OfType() + _dataView = CollectionViewSource.GetDefaultView(TypeDescriptor.GetProperties(obj.GetType()).OfType() .Where(item => PropertyResolver.ResolveIsBrowsable(item)).Select(CreatePropertyItem) .Do(item => item.InitElement())); diff --git a/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyItem.cs b/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyItem.cs index 942078d8c..de3fba4d0 100644 --- a/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyItem.cs +++ b/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyItem.cs @@ -6,7 +6,7 @@ namespace HandyControl.Controls { - public class PropertyItem : Control + public class PropertyItem : ListBoxItem { public static readonly DependencyProperty ValueProperty = DependencyProperty.Register( "Value", typeof(object), typeof(PropertyItem), new PropertyMetadata(default(object))); @@ -107,15 +107,6 @@ public FrameworkElement EditorElement set => SetValue(EditorElementProperty, value); } - public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register( - "IsSelected", typeof(bool), typeof(PropertyItem), new PropertyMetadata(ValueBoxes.FalseBox)); - - public bool IsSelected - { - get => (bool)GetValue(IsSelectedProperty); - set => SetValue(IsSelectedProperty, ValueBoxes.BooleanBox(value)); - } - public static readonly DependencyProperty IsExpandedEnabledProperty = DependencyProperty.Register( "IsExpandedEnabled", typeof(bool), typeof(PropertyItem), new PropertyMetadata(ValueBoxes.FalseBox)); diff --git a/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyItemsControl.cs b/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyItemsControl.cs index edc14d0cf..aa1219db2 100644 --- a/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyItemsControl.cs +++ b/src/Shared/HandyControl_Shared/Controls/PropertyGrid/PropertyItemsControl.cs @@ -2,8 +2,16 @@ namespace HandyControl.Controls { - public class PropertyItemsControl : ItemsControl + public class PropertyItemsControl : ListBox { protected override bool IsItemItsOwnContainerOverride(object item) => item is PropertyItem; + + public PropertyItemsControl() + { +#if !NET40 + VirtualizingPanel.SetIsVirtualizingWhenGrouping(this, true); + VirtualizingPanel.SetScrollUnit(this, ScrollUnit.Pixel); +#endif + } } } \ No newline at end of file diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Base/PropertyGridBaseStyle.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Base/PropertyGridBaseStyle.xaml index 0189a15e0..766d92376 100644 --- a/src/Shared/HandyControl_Shared/Themes/Styles/Base/PropertyGridBaseStyle.xaml +++ b/src/Shared/HandyControl_Shared/Themes/Styles/Base/PropertyGridBaseStyle.xaml @@ -89,13 +89,32 @@ + + - - - - - -