Using UI Editor at runtime on a button click

若如初见. 提交于 2019-12-13 02:51:01

问题


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


回答1:


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?




回答2:


Here is an example I have: http://xacc.svn.sourceforge.net/viewvc/xacc/xacc/Controls/UIEditorForm.cs?revision=7&view=markup



来源:https://stackoverflow.com/questions/2047277/using-ui-editor-at-runtime-on-a-button-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!