Combobox与WPF中的复选框 [英] Combobox with checkboxes in WPF

查看:167
本文介绍了Combobox与WPF中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,



在我的WPF项目中,我需要一个带有复选框的多选组合框。



它应该从数据库动态绑定。



i搜索谷歌,但我找不到与我的问题有关。



你能否提出你的想法来建立这个。



Thnaks

Hi Experts,

In my WPF project i require a multi selectable combobox with checkboxes.

its should be done dynamically binding from the database.

i searched in google, but i haven''t find related to my problem.

can you please provide your ideas to build this.

Thnaks

推荐答案

因为它是WPF,你可以在任何地方放置任何你想要的东西。只需在组合框的内容中添加复选框即可。



你没有 look [ ^ ]非常难
Because it''s WPF, you can put anything you want, anywhere. Just add checkboxes to the template for the contents of your combo box.

You didn''t look[^] very hard


在.NET FCL中没有WPF的这种控件。您将不得不创建自己的自定义控件来实现这些功能。



从基类派生它 System.Windows.Controls.Control

http:/ /msdn.microsoft.com/en-us/library/system.windows.controls.control.aspx [ ^ ]。



另一个想法:从 System.Windows.Controls.Panel ,使现有的复选框控件实例为 Children ,并自定义渲染以添加文本,其余为:

http://msdn.microsoft.com /en-us/library/system.windows.controls.panel.aspx [ ^ ],

http://msdn.microsoft.com/ en-us / library / system.windows.controls.panel.children.aspx [ ^ ]。



可能还有其他一些选择。 说到:克里斯蒂安·格劳斯的回答可能是更好的方法[结束编辑]



开发起来不是很难,我会说,但会密切关注和耐心。



-SA
There is no such control for WPF in .NET FCL. You will have to create your own custom control to implement such features.

Derive it from the base class System.Windows.Controls.Control:
http://msdn.microsoft.com/en-us/library/system.windows.controls.control.aspx[^].

Another idea: derive it from System.Windows.Controls.Panel, make existing check box control instances its Children and custom rendering to add text and the rest:
http://msdn.microsoft.com/en-us/library/system.windows.controls.panel.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.controls.panel.children.aspx[^].

Probably, some other options are possible. Speaking of which: probably the answer by Christian Grauss is a better way to go [END EDIT]

It would not be extremely hard to develop, I would say, but will take close attention and patience.

—SA


这篇关于Combobox与WPF中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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