Is it possible to use RadMaskedTextBox inside an AutoCompleteBox in Silverlight / Expression Blend?
-
29-09-2019 - |
문제
It's probably doable, but with my n00b skills I couldn't figure this out yet.
When I try to "Make Into Part" on the RadMaskedTextBox, Expression Blend complains that it's not a TextBox.
How can I make it to use it as a proper control part? Can I "typecast" somehow in XAML?
Thanks in advance for all help!
해결책
The first answer is correct. While you can insert a RadMaskedTextBox into an autocomplete template (steps below), internally it wants to see a TextBox class to hook up the text changed event. The Telerik RadMaskedTextBox derives from Control instead, so the event is not hooked up.
- Drag an AutocompleteBox onto your page.
- Drag a Terlerik RadMaskedTextBox onto your page (to add the correct XML namespace for you)
- Edit the AutoComplete template in Blend to generate a local template.
- Manually edit the XAML template to use a RadMaskedTextBox instead of the TextBox.
- Remove the Terlerik RadMaskedTextBox
The solution would be to use another Masked edit box that does derive from TextBox and insert it using the above steps
다른 팁
You can't use the RadMaskedTextBox
because it doesn't derive from TextBox
. The code inside AutoCompleteBox
specifies that this part must at least derive from TextBox
.