开发者

With the Telerik Silverlight controls, how can I cast a RadMaskedTextBox as a TextBox

开发者 https://www.devze.com 2023-03-07 18:37 出处:网络
I am trying to determine if a Telerik RadMaskedTextBox allows multiline input. I the debugger, I was able to find and check the .AcceptsReturn property of the underlying textbox, using:

I am trying to determine if a Telerik RadMaskedTextBox allows multiline input.

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;

However, when I paste that into my C# code, the compiler complains that RadMaskedTextBox can开发者_运维技巧not be cast as a TextBox

A little weird, since the Debugger allows it.

The debugger also allows:

((System.Windows.Controls.TextBox)(((Telerik.Windows.Controls.RadMaskedTextBox)(this)).textBox)).TextWrapping

this the compiler complains about

Any ideas?


I tried to do this in the past (sorry can't remember the exact way to go about this) but I had to traverse the object and find the textbox control. If I can find the project where I did it I will update my answer.


From the Telerik Support Forum:

The underlying TextBox is of type ExtendedTextBox. You can access it like so:

var innerBox = this.masktextBox.ChildrenOfType<Telerik.Windows.Controls.MaskedTextBox.ExtendedTextBox>().FirstOrDefault();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号