【问题标题】:Rad Mask TextBox: Change Text to upper and position cursor at end of the text.Rad Mask TextBox:将文本更改为上部并将光标定位在文本的末尾。
【发布时间】:2013-02-11 17:57:45
【问题描述】:

我有 Rad Mask 文本框和一个按钮。因此用户可以在文本框中输入任何大小写。单击按钮时,我正在根据文本和事件获取一些记录,我必须将文本更改为上部,修剪并将插入符号定位到结束。

我注意到,如果输入大写,我会得到所有场景,但是当输入小写时,光标的位置会指向开头。

这是我尝试过的。

        txtSearch.MaskedText = txtSearch.MaskedText.ToUpperInvariant().Trim();
        txtSearch.SelectionOnFocus = SelectionOnFocus.CaretToEnd;

非常感谢您的帮助。

【问题讨论】:

    标签: xaml silverlight-4.0 telerik radmaskedtextbox


    【解决方案1】:

    SelectionStart 已解决需求。

             Dispatcher.BeginInvoke(() =>
            {
                if (txtSearch.MaskedText != null)
                {
                    txtSearch.MaskedText = txtSearch.MaskedText.ToUpper();
                    txtSearch.SelectionStart = txtSearch.MaskedText.Length;
                    txtSearch.Focus();
                }
            });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-31
      • 1970-01-01
      • 2013-07-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多