功能区XML - 如何基于checkBox状态以编程方式启用/禁用ediBox [英] Ribbon XML - How to programmatically enable/disable ediBox based on checkBox state
问题描述
使用C#或VBA,当用户检查/取消选中复选框时,如何使editBox启用/禁用。
Using C# or VBA how can we make the editBox gets enabled/disabled when user checks/unchecks the checkBox.
<tab idMso="TabAddIns">
<group id="ContentGroup" label="Content">
<editBox id ="editBoxID" getEnabled="editBox_getEnabled" enabled="false" getText="Some text"/>
<checkBox id="checkBoxID" label="Edit" getPressed="CheckBox_getPressed"/>
</group>
</tab>
推荐答案
你好,
在 CheckBox_getPressed 回调中,您需要调用
无效或
InvalidateControl 方法允许to 在功能区用户界面上验证控件的缓存值。在
editBox_getEnabled 回调中,您可以检查是否应该启用控件并返回适当的值。
In the CheckBox_getPressed callback you need to call the Invalidate or InvalidateControl method of the IRibbonUI interface which allows to nvalidate the cached value for a control(s) on the Ribbon user interface. In the editBox_getEnabled callback you can check whether to the control should be enabled or not and return an appropriate value.
在MSDN的以下系列文章中阅读更多相关内容:
Chapter 11: Creating Dynamic Ribbon Customizations (2 of 2)
这篇关于功能区XML - 如何基于checkBox状态以编程方式启用/禁用ediBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!