需要替换第 3 方 WinForm 控件,最接近的 WPF 等效项是什么?
我厌倦了 Windows 窗体...我就是厌倦了。我并不是想就此展开辩论,我只是对此感到厌倦。不幸的是,我们已经开始依赖 DevExpress XtraEditors 中的 4 个控件。 我
除了与他们相处遇到困难之外什么都没有,我想继续前进。
我现在需要的是用壁橱替换我正在使用的 4 个控制器。它们是:
LookUpEdit
- 这是一个组合框
,可在您键入时过滤下拉列表。
MemoExEdit
- < em>这是一个文本框
,当获得焦点时会“弹出”更大的区域
CheckedComboBoxEdit
- 这是一个复选框的下拉列表
.
CheckedListBoxControl
- 这是一个由复选框组成的精美列
列表框
,
这是一个LOB 应用程序具有大量数据输入。事实上,前两个很好,但不是必需的。后两个至关重要,因为我要么需要复制功能,要么改变用户与特定数据交互的方式。
我正在寻求帮助,以在具有现有控件(codeplex 等)的 WPF
环境中或在直接 XAML
。任何代码或方向将不胜感激,但大多数情况下我希望避免任何商业第 3 方 WPF,而是希望专注于自己构建它们(但我需要方向)或使用 Codeplex
I am tired of Windows Forms...I just am. I am not trying to start a debate on it I am just bored with it. Unfortunately we have become dependent on 4 controls in DevExpress XtraEditors. I
have had nothing but difficulties with them and I want to move on.
What I need now is what the closet replacement would be for the 4 controls I am using. Here they are:
LookUpEdit
- this is a combobox
that filters the dropdown list as you type.
MemoExEdit
- this is a textbox
that 'pops up' a bigger area when it has focus
CheckedComboBoxEdit
- this is a dropdown of checkboxes
.
CheckedListBoxControl
- this is a nicely columned listbox
of checkboxes
This is a LOB app that has tons of data entry. In reality, the first two are nice but not essential. The second two are essential in that I would either need to replicate the functionality or change the way the users are interacting with that particular data.
I am looking for help in replicating these in a WPF
environment with existing controls(codeplex etc) or in straight XAML
. Any code or direction would be greatly appreciated but mostly I am hoping to avoid any commercial 3rd party WPF and would instead like to focus on building them myself(but I need direction) or using Codeplex
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WPF 的优点之一是自定义控件非常容易(尤其是与 WinForms 相比)。根据您给出的描述,所有这些控件都可以使用标准工具箱控件非常简单地创建;我认为您不需要购买任何第三方解决方案。从顶部开始:
LookUpEdit
- 您可以使用 WPF 组合框MemoExEdit
免费获得此内容TextBox
控件和 < code>Popup 原语,您可以用相对较少的努力复制此效果CheckedComboBoxEdit
- WPFComboBox
是一个ItemsControl
,并且意味着它支持自定义项目模板。您可以使用几行 XAML 轻松完成此操作。CheckedListBoxControl
- 对于ListBox
来说也是如此,使用ItemTemplate
属性您可以立即完成此操作。下面是一个简单示例,说明如何实现类似于
CheckedComboBoxEdit
的控件。首先,代码隐藏:现在,
Window
的 XAML:ItemTemplate
属性的意思是,“对于此控件中的每个项目,将我设为其中之一。”因此,对于ComboBox
的Items
集合中的每个项目,都会生成一个CheckBox
,其Content
绑定到项目类的Name
属性,及其绑定到Checked
属性的IsChecked
属性。这是最终结果:
alt text http://img155.imageshack.us/img155/9379/customcontrols.png
One of the beautiful things about WPF is how easy it is to customize controls (especially when compared to WinForms). Based on the descriptions you've given, all of these controls could be created quite simply with the standard toolbox controls; I don't think you will need to purchase any third-party solutions. Starting from the top:
LookUpEdit
- you can get this for free using the WPF combo-boxMemoExEdit
- using the standardTextBox
control and thePopup
primitive, you could duplicate this effect with relatively little effortCheckedComboBoxEdit
- the WPFComboBox
is anItemsControl
, and that means it supports custom item templates. You could do this easily with a couple lines of XAML.CheckedListBoxControl
- same thing for theListBox
, using theItemTemplate
property you can have this going in no time.Here is a quick example of how you could implement a control resembling the
CheckedComboBoxEdit
. First, the code-behind:Now, the XAML for the
Window
:What the
ItemTemplate
property says is, "for each item in this control, make me one of these." So for every item in theItems
collection of theComboBox
, aCheckBox
is generated, with itsContent
bound to theName
property of your item class, and itsIsChecked
property bound to theChecked
property.And here is the end result:
alt text http://img155.imageshack.us/img155/9379/customcontrols.png