简体   繁体   English

克隆WPF ComboBox控件:想法或建议

[英]Cloning the WPF ComboBox control: Ideas or suggestions

If have a control that acts like a record selector from a database, say, for example, customers. 如果控件的行为类似于数据库中的记录选择器,例如说客户。

The control must act in certain ways allowing the user to type the name, the alias or the code of the customer, and the control will select the correct one , or offer a list of possible candidates, and other behaviors. 控件必须以某些方式操作, 允许用户键入名称,别名或客户代码,并且控件将选择正确的 ,或提供可能的候选对象列表以及其他行为。

I have tried to inherit from ComboBox , but there are some ComboBox behaviors that make it difficult or impossible to do what I want, so I'm better starting from scratch, with a TextBox and Button. 我尝试从ComboBox继承,但是有些ComboBox行为使执行我想要的事情变得困难或不可能,所以最好从头开始使用TextBox和Button。

The questions are: 问题是:

  • Do you know some open-source component so I don't have to start from zero? 您是否知道一些开源组件,所以我不必从零开始?
  • Have you already done something like this and want to share methodologies or tips? 您是否已经做过这样的事情并想分享方法或技巧?
  • Am I good with a TextBox, a Button and a PopUp control? 我可以使用TextBox,Button和PopUp控件吗?

Try this control from CodeProject: A Reusable WPF Autocomplete TextBox 从CodeProject中尝试以下控件: 可重用的WPF自动完成文本框

It allows you to specify a source list, and a custom filter. 它允许您指定源列表和自定义过滤器。 In your custom filter you can select to show only those records that have a name, alias or code that fit the text entered, and the user will have a list of filtered options displayed to them. 在您的自定义过滤器中,您可以选择仅显示那些名称,别名或代码适合所输入文本的记录,并且用户将看到显示给他们的过滤选项列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM