This commit is contained in:
NaBian committed 2020-10-12 01:09:35 +08:00
1 parent 940117adc5
commit 64cd77ece0
4 files changed
+36 -30

No files matched your search

@@ -126,7 +126,7 @@ namespace HandyControl.Controls
{
if (obj == null || _itemsControl == null) return;
_dataView = CollectionViewSource.GetDefaultView(TypeDescriptor.GetProperties(obj).OfType<PropertyDescriptor>()
_dataView = CollectionViewSource.GetDefaultView(TypeDescriptor.GetProperties(obj.GetType()).OfType<PropertyDescriptor>()
.Where(item => PropertyResolver.ResolveIsBrowsable(item)).Select(CreatePropertyItem)
.Do(item => item.InitElement()));
@@ -6,7 +6,7 @@ using HandyControl.Data;
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 @@ namespace HandyControl.Controls
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));
@@ -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
}
}
}