سؤال

It's not possible to do a autocompletebox.Focus(), but there seems to be a work around : TextBox textBox = autoBox.Template.FindName("Text", autoBox) as TextBox;

However, there is no method FindName in Windows Phone. How can I work around this ?

هل كانت مفيدة؟

المحلول

Fetch the short chunk of source code from this blog about VisualTreeEnumeration. (Note the comment about Toolkit's own VisualTreeExtensions class doesn't apply the the WP7 toolkit).

Now you can retrieve the internal TextBox with:-

textBox = autoBox.Descendents().OfType<TextBox>().FirstOrDefault(t => t.Name == "Text");
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top