Using UI Editor at runtime on a button click

2019-09-02 09:42发布

I have a custom UI Editor for a property in C# . The editor works fine at design time. How ever I want to lauch the editor on click of a button at runtime. How can I do this?

Thanks, Datte

2条回答
放我归山
3楼-- · 2019-09-02 10:08

Using a UITypeEditor in custom (i.e. runtime) scenarios is definitely a trick proposition. The most obvious part about launching a UITypeEditor is quite trivial: Just cast the instance to UITypeEditor and call EditValue or whatever other method you want.

One of the hardest parts about using them is figuring out what type descriptor context to provide, and harder yet, figuring out which services to provide.

The more you know about the particular editor you are trying to host the better you will know what context and service to provide.

What you're trying to do is definitely possible (obviously Visual Studio can do it), but it might be very difficult.

What have you tried so far and what isn't working?

查看更多
登录 后发表回答