且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在自定义控件的设计模式下的组合框自定义控件中添加项目

更新时间:2022-12-11 17:56:25

错误的主意.您应该从数据中添加项目,而不是通过Designer对其进行硬编码".我必须尝试一下-这样的坏主意从未见过我的脑袋...

好的,如果在Designer中显示控件,则在右上角有一个通常的小错误按钮,单击它-它会弹出带有编辑项目"的组合框任务"-单击它并编辑您的项目.

问题解决了.

但是... 不要这样做!即使项是常量,也应始终根据数据填充或数据绑定控件.您尝试执行的操作根本无法维护.将Designed仅用于布局,别无其他.

—SA
Bad idea. You should add items from data, not "hard-code" them through Designer. I have to try it — such a bad idea never visited my head…

OK, there is a usual small error button on right top edge if the control shown in Designer, click it — it will pop-up "ComboBox Tasks" with "Edit items" — click it and edit your items.

Problem solved.

But… don''t do it! You should always populate or data-bind your controls based on data, even if your items are constants. What you''re trying to do is not maintainable at all. Use Designed only for layouts, nothing else.

—SA