使用Telerik Silverlight控件,如何将RadMaskedTextBox投射为TextBox [英] With the Telerik Silverlight controls, how can I cast a RadMaskedTextBox as a TextBox
问题描述
我正在尝试确定Telerik RadMaskedTextBox是否允许多行输入.
I am trying to determine if a Telerik RadMaskedTextBox allows multiline input.
作为调试器,我能够使用以下方法找到并检查基础文本框的.AcceptsReturn属性:
I the debugger, I was able to find and check the .AcceptsReturn property of the underlying textbox, using:
((System.Windows.Controls.TextBox)(((Telerik.Windows.Controls.RadMaskedTextBox)(this)).textBox)).AcceptsReturn;
但是,当我将其粘贴到C#代码中时,编译器抱怨RadMaskedTextBox无法转换为TextBox
However, when I paste that into my C# code, the compiler complains that RadMaskedTextBox cannot be cast as a TextBox
有点奇怪,因为调试器允许它.
A little weird, since the Debugger allows it.
调试器还允许:
((System.Windows.Controls.TextBox)(((Telerik.Windows.Controls.RadMaskedTextBox)(this)).textBox)).TextWrapping
这是编译器抱怨的
有什么想法吗?
推荐答案
在Telerik支持论坛中:
From the Telerik Support Forum:
基础TextBox的类型为ExtendedTextBox.您可以这样访问它:
The underlying TextBox is of type ExtendedTextBox. You can access it like so:
var innerBox = this.masktextBox.ChildrenOfType<Telerik.Windows.Controls.MaskedTextBox.ExtendedTextBox>().FirstOrDefault();
这篇关于使用Telerik Silverlight控件,如何将RadMaskedTextBox投射为TextBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!