大佬教程收集整理的这篇文章主要介绍了Silverlight 5 AutoCompleteBox = Bug,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
将AutoCompleteBox和Button添加到主页面.注册TextChanged和Click事件.这是代码隐藏:
public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } private void button1_Click(object sender,RoutedEventArgs E) { auto.Text = String.Empty; } private void auto_TextChanged(object sender,RoutedEventArgs E) { // Put a break point here. } }
在运行时:
1)在autoBox中输入“aa”.
2)单击按钮.
3)键入“q”. (仍调用TextChanged).
4)擦除“q” – 不调用TextChanged.
5)再次输入“q” – 不调用TextChanged.
6)依此类推,直到你选了一封新信.然后它重新开始.
当内部TextBox TextChanged事件触发时,您需要手动触发AutoCompleteBox控件的TextChanged事件.
public class CustomAutoComplete : AutoCompleteBox { TextBox myText; public override void OnApplyTemplate() { base.onApplyTemplate(); myText = GetTemplateChild("Text") as TextBox; myText.TextChanged += new System.Windows.Controls.TextChangedEventHandler(myText_TextChanged); } void myText_TextChanged(object sender,System.Windows.Controls.TextChangedEventArgs E) { this.Text = myText.Text; OntextChanged(new RoutedEventArgs()); } }
以上是大佬教程为你收集整理的Silverlight 5 AutoCompleteBox = Bug全部内容,希望文章能够帮你解决Silverlight 5 AutoCompleteBox = Bug所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。