好的 NumericUpDown 等效于 WPF?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/382676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:53:21  来源:igfitidea点击:

Good NumericUpDown equivalent in WPF?

wpfspinnernumericupdown

提问by devios1

I'm looking for a simple NumericUpDown (a.k.a. number spinner) control in WPF. This seems to be another lacking control in WPF. There must be some existing ones out there and I don't like to re-invent the wheel.

我正在 WPF 中寻找一个简单的 NumericUpDown(又名数字微调器)控件。这似乎是 WPF 中另一个缺乏控制的地方。那里肯定有一些现有的,我不想重新发明轮子。

采纳答案by Brian Lagunas

The Extended WPF Toolkit has one: NumericUpDownenter image description here

扩展 WPF 工具包有一个:NumericUpDown在此处输入图片说明

回答by Daniel DeSousa

Here is an MIT license project with a dll for a WPF control for what you are describing. It allows for customization of increments, minimum, maximum and value with a similar interface to the slider control.

这是一个 MIT 许可证项目,其中包含一个用于您所描述的 WPF 控件的 dll。它允许使用与滑块控件类似的界面自定义增量、最小值、最大值和值。

http://code.google.com/p/phoenix-control-library/

http://code.google.com/p/phoenix-control-library/

回答by Artur Carvalho

This may help: Numeric Data Entry in WPF

这可能会有所帮助:WPF 中的数字数据输入

回答by Magnus Lindhe

MahAppshas a NumericUpDowncontrol:

MahApps有一个NumericUpDown控件:

MahApps NumericUpDown

MahApps NumericUpDown

回答by David Hollinshead

A few other (commercial) options:

其他一些(商业)选项:

回答by Simon D.

If commercial solutions are ok, you may consider this control set: WPF Elements by Mindscape

如果商业解决方案没问题,您可以考虑使用此控件集: Mindscape 的 WPF Elements

It contains such a spin control and alternatively (my personal preference) a spin-decorator, that can decorate various numeric controls (like IntegerTextBox, NumericTextBox, also part of the control set) in XAML like this:

它包含这样一个旋转控件,或者(我个人偏好)一个旋转装饰器,它可以像这样在 XAML 中装饰各种数字控件(如 IntegerTextBox、NumericTextBox,也是控件集的一部分):

<WpfElements:SpinDecorator>
   <WpfElements:IntegerTextBox Text="{Binding Foo}" />
</WpfElements:SpinDecorator>

回答by Skarstoker

add a textbox and scrollbar

添加文本框和滚动条

in VB

在VB中

Private Sub Textbox1_ValueChanged(ByVal sender As System.Object, ByVal e As System.Windows.RoutedPropertyChangedEventArgs(Of System.Double)) Handles Textbox1.ValueChanged
     If e.OldValue > e.NewValue Then
         Textbox1.Text = (Textbox1.Text + 1)
     Else
         Textbox1.Text = (Textbox1.Text - 1)
     End If
End Sub