简体   繁体   English

如何在Windows Phone 8.1运行时中消除对AutoSuggestBox的关注?

[英]How to dismiss focused of AutoSuggestBox in Windows Phone 8.1 Runtime?

I have a project using AutoSuggestBox, It is working well, however, I have some problems with this control. 我有一个使用AutoSuggestBox的项目,它运行良好,但是,此控件存在一些问题。 My problem has 2 question, but I apologize because I don't want to separate them and they are related to each other. 我的问题有2个问题,但我很抱歉,因为我不想将它们分开,并且它们彼此相关。 Here is my question: 这是我的问题:

  1. I have a AutoSuggetsBox which searches for location, after I chose the result from suggested list, I set the content of AutoSuggetsBox is. 我有一个搜索位置的AutoSuggetsBox,从建议列表中选择结果后,将AutoSuggetsBox的内容设置为。 But my AutoSuggetsBox think that chosen item as a new query string and raised the text changed event again. 但是我的AutoSuggetsBox认为选择的项目是新的查询字符串,并再次引发了文本更改事件。 How can I do to solve that? 我该怎么解决?
  2. I want to dismiss (or unfocus) a AutoSuggetsBox when I tap to other controls. 当我点击其他控件时,我想关闭(或取消对焦)AutoSuggetsBox。 how to do that? 怎么做?

These are my questions, if you are annoyed with its length, i apologize for that. 这些是我的问题,如果您对它的长度感到烦恼,对此我深表歉意。 I hope you guys can help me, thanks a lot! 希望你们能帮助我,非常感谢!

Instead of using TextChanged event try using QuerySubmitted and SuggestionChosen event it might resolve your problem. 与其使用TextChanged事件,不如尝试使用QuerySubmitted和RecommendationionChosen事件,它可以解决您的问题。 For your second question when new element gets focused on tap previous is automatically unfocused but if you want to handle it manually then use 对于第二个问题,当新元素专注于水龙头上一个元素时,它会自动失去焦点,但是如果您要手动处理它,请使用

MYSuggestBox.Focus(FocusState.UnFocused)

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从Windows Phone 8.1中的AutoSuggestBox获取所选项目 - How to get selected item from AutoSuggestBox in Windows Phone 8.1 Windows Phone 8.1中的AutoSuggestBox出现奇怪的结果 - Strange results in AutoSuggestBox in Windows Phone 8.1 如何通过在Windows Phone 8.1中点击它的网站来解雇ContentDialog? - How to dismiss a ContentDialog by tapping out site of it in Windows Phone 8.1? Windows Phone 8.1运行时应用 - Windows phone 8.1 runtime apps 如何将项目从 Windows Phone 8.1 Silverlight 转换为 Windows Phone 8.1 Runtime - How to convert project from Windows Phone 8.1 Silverlight to Windows Phone 8.1 Runtime 如何在Windows Phone 8.1运行时应用程序中显示计划的对话框? - How to show a scheduled dialog in a Windows Phone 8.1 Runtime app? 如何在Windows Phone 8.1 Runtime中获取连接和运营商信息 - How to get connection and carrier information in Windows Phone 8.1 Runtime Windows Phone 8.1(运行时):如何在FlipView中显示图像列表? - Windows Phone 8.1 (Runtime): How to show a list of images in a FlipView? Windows Phone 8.1:在运行时加载BitmapImage - Windows Phone 8.1: loading a BitmapImage at runtime Windows Phone 8.1 Runtime中的阴影效果? - Drop shadow effect in Windows Phone 8.1 Runtime?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM