Windows Phone 8.1 - Auto Complete and ListBox Focus - xaml

I have textbox and a listbox. On typing into textbox, listbox will start populate suggestions based on text typed in textbox. The Listbox is inside a popup and will open only if there are any suggestions. A traditional custom auto suggestion box.
Now the problem is, when user started typing, the popup will open and steal the focus from textbox. So user cannot continue typing. What is the best and standard approach to solve this problem?
I tried focusing the textbox, as soon as the popup opens. But still it has a small lag (for the first time, when ListBox rendered) and I could see a flickering with virtual keypad jumping up and down.

It seems like you need to stop the text box from losing focus...
I am assuming you are using MVVM(Model View ViewModel) for your list box and text box. So I would have a search criteria value in my view model populate the list in the pop-up.
<TextBox Text="{Binding Path=SearchCriteria, Mode=TwoWay, UpdateSourceTrigger=Explicit}"></TextBox>
UpdateSourceTrigger is the key, by default text box only updates on lost focus But when you change the binding to UpdateSourceTrigger=Explicit, it will update the view model on every key stroke.
This way you can re-filter the list with every key stroke and the text box will not lose focus.

Related

How to unfocus from all inputs/elements in Selenium without tabbing out

I have a form where I fill in textboxes through selenium (java). Some of the textboxes dynamically generate extra content when you click on them and remove the content when you focus on something else. This is a problem when I automate because if I am focused on a text box and try to click on something else, when the page removes the content it doesn't register my click and I need to click again. This leads to flakey behaviour since I need to now consider whether I need to click or double click a button depending on what element I was focused on before.
I can't send a tab key to the text box because sometimes it will tab into another textbox that has the same dynamic generation behaviour, leading to the same scenario as before.
I tried clicking the page element but it also doesn't seem to work. I also tried clicking the root div. It just doesn't seem to register my click (I also tried jsclicks)
What I would like to do is have a general way to unfocus a text box after I fill it.
Thanks!

Program does not tab through controls in the correct order

I have a form with a button which adds text boxes in addition to the 8 text boxes already on the form which are named Textbox1 through 8. When I launch the application and enter the first textbox, I can tab through all the way from 1 - 8.
When I click my button it programmatically creates a textbox below the last textbox with appropriate name such as Textbox9 for the ninth, Textbox10 for the tenth etc.
However when a textbox is added via the button, tabbing through the controls skips from the eighth, to any buttons on the form, and then to the created textbox. Any idea why this happens and how I can resolve it? I've tried google to no avail. Please let me know if you need any code, thank you.
Thanks to Daniel Cook and Grim, I solved my issue by setting the tabindex to match the textbox number, however I also found that setting TabStop to false on the buttons and controls helped me to keep the tab focus within the text boxes.

How to determine which form controls the keyboard input on VB.net

I'm developing a VB.net windows application and I have some issues with the keyboard input.
My application has different forms and I'm showing and hidding them with the user interaction. One of the inputs comes from the keyboard, and here is where I have a problem.
When I hide a form and show the next one, most of the times the new-shown form does not receive the keyboard input until I click somewhere on it.
I assume that the problem is that the new form I'm showing is not the "selected application" for windows until the user interacts with it by clicking on it, but I don't know how to set this "property" by code.
I tried with focus and select on the whole form (Me.select/focus) and in some form's control (me.lbl_xxx.select/focus), but I did not get any result.
Can anyone explain me how to control which application/form gets the keyboard input on windows?
Thanks
David
You can't really interact with a label so the input focus won't be set properly.
Focussing a specific textbox on your form on the other hand should just work fine.

vb.net textbox that won't let me highlight text

I'm working on an upgrade of a VB6 winforms project to VB.Net 2.0. On one form (and only this one form, out of about 25), my text boxes are acting odd.
When a user clicks into (focuses on) a textbox with a value in it, the cursor automatically goes to the beginning (left side) of the textbox and can only be moved with the keyboard arrow keys. I can't re-position the cursor with the mouse, and I can't highlight a section of text with the mouse.
The text box is not readonly and is both visible and enabled. In fact all settings are default as I've dragged out a new textbox and added it to the form and I get the same behavior.
Any ideas would be greatly appreciated.
OK, here is answer:
The startup form was set as an MdiContainer. This form had a split panel container that held another form for Application controls in panel 1 and the working forms in panel 2. When the working forms were loaded into panel 2, they weren't allowed to be top level as there was a .Parent attribute set to the split container panel 2. For some reason, the highlighting of text in a text box is disallowed unless the textbox is on a top level form, and since we couldn't get the working form to top level, we couldn't highlight the text. For reference, check this out.

Metro App Create Email Address Entry Xaml Control

How do I create a Control to input email addresses, similar to how capturing tags on stackoverflow works?
I am using C# and Xaml.
You will need:
TextBox(to show input area where you can type)
Popup(to show suggestions below TextBox like StackOveflow does)
ItemsControl(it goes into Popup, so you can just have collection of items and they will be displayed, note that ItemsPanel should be probably GridView)
Then you will need custom Button, that will be overlaid top of TextBox once tag has been added. You need to calculate how big is the button(width) and fill TextBox with empty spaces, to advance cursor further.
Also you need to control what keys are being pressed.
The effect you are after is probably that you recognize complete e-mail addresses, and render them in a custom way. I would do this by removing the completed addresses from the textbox, and wrap them in a skinned label (or maybe a custom control with a delete button).
The most straightforward way is to implement the textbox as a DockPanel with a border, suggesting that it is a text box. On the left side of your DockPanel, you have a StackPanel where you stack the completed address controls left-to-right. Then add a textbox with DockStyle=Fill to fill up the remainder of the DockPanel. Once you detect an email address is entered, you remove the characters from the textbox and add a matching control to the StackPanel.
There is probably a way to change the textbox contents without losing focus, otherwise you need to fix this though code.
Good luck!