microsoft / winforms-designer-extensibility

MIT License
56 stars 13 forks source link

How to add custom Verbs at Server or Client? #36

Open valiahmetovv opened 5 months ago

valiahmetovv commented 5 months ago

Hi @KlausLoeffelmann

I'm trying to implement a simple verb for RootDesigners and ComponentDesigners: image

I have added standard code at server side component designer:

public override DesignerVerbCollection Verbs=> _designerVerbs ??= new DesignerVerbCollection { new DesignerVerb("Properties...", delegate { OpenCustomDialogue(); }) };

OpenCustomDialogue method sends a notification to client side so required dialog can be opened, This seems to work, but could you please clarify if this is the recommended way? Is it possible to initialize a ViewModel, similar to TypeEditors viewmodels, for dialogs opened this way?

I have also tried adding verbs at client side during ComponentDesignerProxy initialization, but i got the following error: VerbError