views:

59

answers:

2

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!

A: 

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.

AnthonyWJones
Would it be really complicated to customise that code? I`d expect RadMaskedTextBox to behave very similarly to TextBox, so maybe there`s not that much work to do there? How would you set out to do this?
dain
A: 

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

Enough already
So then the not-so-nice, but working solution could be putting the RadMaskedTextBox over the original TextBox and wiring them together in C#, so the value of the RadMaskedTextBox gets written into the TextBox as the user types?Wait, but then I`d also have to wire things the other way too, so if something is chosen from the popup that`ll be sent to the RadMaskedTextBox :/
dain