【问题标题】:Default value of telerik RadNumericUpDown in WPFWPF 中 Telerik RadNumericUpDown 的默认值
【发布时间】:2020-05-14 09:00:06
【问题描述】:

我正在开发一个 web 应用程序,它包括一个来自 telerik 的 RadNumericUpDown。允许用户输入的最小值为 0.1。似乎第一次加载页面时,它默认为最小值(0.1)。这是一个问题,因为它显示的是 0.1,但在用户进行更改之前,此值不会传递到代码中。

我遇到的另一个问题是,因为默认值为 0.1,所以按向上箭头会将其向上移动到 1.1、2.1 等。我希望它从 1 移动到 2。

我希望向上向下按钮做的是在没有设置值时不显示任何值。当按下向上箭头时,我希望它转到 1。如果用户需要十进制值,他们可以手动设置它。

有谁知道我该怎么做:

  • 将默认值设置为最小值以外的其他值
  • 或在页面加载时获取更新框。

我在telerik documentation 中找不到任何内容。

这是我当前的 RadNumericUpDown:

<telerik:RadNumericUpDown Grid.Row="4"
         Grid.Column="1"
         Minimum="0.1"
         Style="{StaticResource RadNumericUpDown}"
         NumberDecimalDigits="1"
         Value="{Binding SampleRateText, Mode=TwoWay}"
         UpdateValueToMatchTextOnLostFocus ="True"
         Visibility="{Binding IsTimeRateVisible}" />

任何帮助将不胜感激!

【问题讨论】:

    标签: c# wpf xaml telerik


    【解决方案1】:

    您绑定到的SampleRateText 源属性应返回default(double?) 或您要显示的任何默认double 值。它是控件中显示的Value 属性的当前值。

    如果您想从0.1 增加到0.2,您应该将SmallChange 设置为0.1 或处理ValueChanged 事件并编写您的自定义逻辑。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-15
      • 1970-01-01
      • 1970-01-01
      • 2016-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多