如何获得功能区的ComboBox控件的价值? [英] How to get value of the ribbon's ComboBox control?

查看:99
本文介绍了如何获得功能区的ComboBox控件的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ComboBox控件中应用过滤功能,用户在ComboBox中键入一些文本,我将过滤下拉列表中的列表。


为此,我需要在填充下拉值之前将值输入到ComboBox中,如何以编程方式获取ComboBox值?我知道如果用户点击"输入"键入一些文本后,它会触发OnChange函数,
但我面临的问题是当用户输入某些文本然后立即点击下拉箭头以显示下拉列表时。


当用户在键入文本后单击下拉箭头上的单击时,代码将转到getItemCount,getItemLabel,然后只转到onChange,这已经太晚了。我需要在getItemCount本身(或之前)获取用户输入的文本,这样
我可以过滤要在getItemLabel中使用的列表。

解决方案

您好,


Fluent UI不提供任何内容。您可以尝试使用
辅助功能API
作为变通方法。


基本上,您需要使用自定义任务窗格,您可以在其中自由使用Windows窗体或WPF控件。有关详细信息,请参阅

自定义任务窗格
。或者,如果您开发Outlook加载项,您可以考虑

创建Outlook表单区域
 。


在以下系列文章中阅读有关Fluent UI(aka Ribbon UI)的更多信息:


自定义2007 Office Fluent Ribbon for Developers(第1部分,共3部分)


为开发人员自定义2007 Office Fluent功能区(第2部分,共3部分)


为开发人员定制2007 Office Fluent功能区(第3部分,共3部分)


I would like to apply filtering capabilities in the ComboBox control, where a user types in some text in the ComboBox, and I will filter the list to be populated in the drop-down.

To do this, I need to get the value typed into the ComboBox before populating the drop-down values, how can I get the ComboBox value programatically? I know that if user hits "Enter" after typing some text, it will trigger the OnChange function, but the problem I'm facing is when user types in some text then immediately clicks on the drop-down arrow to show the drop-down list.

When user clicks on the clicks on the drop-down arrow after typing the text, the code goes to getItemCount, getItemLabel, then only onChange, which is too late. I need to get the text input by user during getItemCount itself (or before that), so that I can filter the list to be used in getItemLabel.

解决方案

Hello,

Fluent UI doesn't provide anything for that. You may try to use Accessibility API as a workaround.

Essentially, you need to use a custom task pane where you are free to use Windows Forms or WPF controls. See Custom Task Panes for more information. Or if you develop an Outlook add-in you may consider Creating Outlook Form Regions .

Read more about the Fluent UI (aka Ribbon UI) in the following series of articles:

Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)

Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)

Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)


这篇关于如何获得功能区的ComboBox控件的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆