So I want this behaviour that when the combobox is in focus and I press a letter on the keyboard it should automatically select the 1st item which starts with that pressed letter, I found out this behaviour was built into combobox with property "IsTextSearchEnabled" so it was working fine until I discovered that if a combobox is in a content dialog this property set to "true" doesnt work anymore.
<ComboBox
Header="States, with keyboard support"
IsTextSearchEnabled="True"
ItemsSource="{Binding States2}" />
Related
I am using Prism 5 and I show a modal dialog via NotificationRequest. I want the focus set in the OK button, so the user can just press Enter to skip de message (now it works with Tab -> Tab -> Enter). I have tried many ways, but no one is working:
<i:Interaction.Triggers>
<prism:InteractionRequestTrigger SourceObject="{Binding NotificationRequest, Mode=OneWay}">
<prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True" FocusManager.FocusedElement="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.OKButton}"/>
</prism:InteractionRequestTrigger>
</i:Interaction.Triggers>
Of course the dialog is showing and there are no errors. The only trouble is the focus in the button.
How can I get this behaviour? What I want is the user press the enter key and the PopupWindow closes as if the button were clicked.
Good catch! Please submit this as an issue here: https://github.com/PrismLibrary/Prism/issues
We will get this fixed with the next update.
Until then, you would have to use a custom window dialog. Check out this sample to learn how to do that.
https://github.com/PrismLibrary/Prism-Samples-Wpf/tree/master/InteractivityQuickstart
Check out the custom popup view: https://github.com/PrismLibrary/Prism-Samples-Wpf/blob/master/InteractivityQuickstart/InteractivityQuickstart/Views/CustomPopupView.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.
I am using Xamarin.Forms, with my view created fully in XAML. I am also using Xamarin.Forms.Labs.
I have bound an EntryCell to a property like so:
<EntryCell Label="Name:" Text="{Binding Name, Mode=TwoWay}" />
The page has a 'Save' ToolBarItem which saves the property to a database.
The issue I have is that the Name property is only updated when the entry cell loses focus after the user changes the text. Clicking the ToolBarItem does not change focus and therefore the property is not updated before being saved.
I would like the property to be updated with every key press from the user. I know of 'UpdateSourceTrigger' for Silverlight, but I can't find an equivalent way to do this in Xamarin Forms?
There is no equivalent for UpdateSourceTrigger in Xamarin.Forms
There doesn't seem to be a xamarin equivalent to UpdateSourceTrigger. I have had success by removing the SetProperty call from the bound property so that the property changed does not fire, and then using EntryUnfocused to trigger an explicit PropertyChanged event.
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.
I have many controls in a panel. One is a System.Windows.Forms.Label next to a text box, and another control is a Telerik.WinControls.UI.RadDropDownList.
The dropdown list has two items: True and False.
The label has a Text value of "%Type" (so a shortcut there).
When the dropdown list is focused and you press F, the False item gets selected, which is good. But if you press T, without the ALT key down, the focus jumps because of the label shortcut and the text box gets the focus.
Has anyone experienced this behavior or have any idea on how to work around this?
I noticed that the KeyDown event of the dropdown list is being triggered when pressing T but not the KeyUp or KeyPress event. Also, as soon as I remove the & from the label text, everything works fine.
Thanks!