Some questions about porting collections editors
kirsan31 opened this issue · 1 comments
All text down here are not actual. I've got that I need connect Microsoft.DotNet.DesignTools.Client.Editors.CollectionEditor
with Microsoft.DotNet.DesignTools.Editors.CollectionEditor
some how...
I will update or close this later...
First of all if the editor inherited from System.ComponentModel.Design.CollectionEditor
then designer not work at all - no elements in the editor. There is a connection between the client and the server - in the debugger I can see that editor instances are created, but they are always empty. I think it's because the old CollectionEditor
doesn't know anything about the proxy object (which is passed as a type to the constructor) - am I right?
If I change System.ComponentModel.Design.CollectionEditor
with Microsoft.DotNet.DesignTools.Client.Editors.CollectionEditor
(with some modifications of course) - the items will appear.
So, because I have no choice, I continue with Microsoft.DotNet.DesignTools.Client.Editors.CollectionEditor
...
And here we have plenty of questions...
In old (System.ComponentModel.Design.CollectionEditor
) we have this methods (which are not in the new):
-
protected virtual bool CanRemoveInstance (object value);
- We can bypass it some how. -
protected virtual object SetItems (object editValue, object[] value);
- Big problem. How to deal with items removal? I need to do some actions after item is removed - don't know hot to do it in new editor :( -
protected virtual Type[] CreateNewItemTypes ();
- How to deal with complex collection editor with many different classes in it? In old one If we overrideType[] CreateNewItemTypes ()
, we will haveNewItemTypes
return our types, and UI changed like this:
In new
CollectionEditor
we have noCreateNewItemTypes ()
at all, but we haveNewItemTypes
🤔
How to achieve this functionality with new designer? How we can add multiple types toprotected virtual object? CreateInstance(Type itemType);
I understand, that in 99% cases we will have no this types in client. But may be do something similar but with strings, or objects, something else?
protected virtual string[] CreateNewItemTypes (); protected virtual object? CreateInstance (string itemType);
Ui will change like it was in .Net Framework and in
CreateInstance(string itemType)
we will try to get this type proxy through endpoint from server base on string name (at the moment I don't quite understand how to do this)?
And this again crossing with point 2. from #4...
Collection editor sample here: https://github.com/KlausLoeffelmann/NetControlDesigners/tree/main/src/Samples/Previous%20Versions/Sophisticated%20-%20CollectionEditor again is over complicated :(
And based on my experience with the rest of the editors, I think there must be a way to solve problems above without such complications. And if not, then we definitely need away to do it :)
Yes, all become clear now.