Make get-only collections editable in propertygrid

This commit is contained in:
Brant Martin
2018-07-03 14:47:36 -04:00
parent 7bad6149b5
commit 5496ad1198

View File

@@ -150,7 +150,7 @@ namespace Torch.Views
valueControl = (FrameworkElement)Activator.CreateInstance(descriptor.EditorType);
valueControl.SetBinding(FrameworkElement.DataContextProperty, property.Name);
}
else if (property.GetSetMethod() == null || descriptor?.ReadOnly == true)
else if (property.GetSetMethod() == null && !(propertyType.IsGenericType && typeof(ICollection).IsAssignableFrom(propertyType.GetGenericTypeDefinition()))|| descriptor?.ReadOnly == true)
{
valueControl = new TextBlock();
var binding = new Binding(property.Name)