Pregunta

I have a custom control is named WatermarkPasswordBox and I want to add InputScope property for using numeric virtual keyboard in WinRT, Win8. But it's base class is not Textbox, it's base class is Control. How can I do it?

Thanks.

¿Fue útil?

Solución

In WPF you could add an owner to the InputScopeProperty. But, of course, we're not using WPF here. Even if that were available, I'm not sure it alone would solve your problem anyway.

To answer your question:

  1. Define your own InputScopeProperty on your custom PasswordBox.
  2. Insert a TextBox into your custom control's control template.
  3. Use a TemplateBinding to bind the TextBox's InputScope to your custom InputScope.

What's preventing you from deriving from PasswordBox? Your custom PasswordBox should serve its single, specific purpose so this is something to consider.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top