Prism NotificationRequest focus on OK button - xaml

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

Related

Uwp Combobox IsTextSearchEnabled doesnt work in a dialog

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}" />

I am having trouble while clicking a "Submit An App" button on my application which is present on the Menu bar

I am using the below code for this, this is present inside a frame and this also clicks the button but after button is clicked the control is lost. The possible reason i see is the page lands on same page which extra options after the "Submit An App" button is clicked.
I am using c# to code it. The first line finds the button the second line clicks but go for a timeout. I have seen this behavior fist time not sure how to work it out.
IWebElement field = VelocityDriver.FindElement(By.Id("AppSub"));
SeleniumExtensions.ClickElementAndContinue(field);

Windows Phone 8.1 - Auto Complete and ListBox Focus

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.

Using Robotium with a contextual menu

I'm testing an application with Robotium, and I have a custom listview with checkboxes. When I click on a checkbox it loads a contextual menu giving the user buttons to modify and delete those items.
I can get Robotium to click the checkbox which loads the menu, but for some reason I can't get it to click on the delete button.
I've tried:
solo.clickOnActionBarItem(R.id.menu_delete);
solo.clickOnMenuItem("Delete");
solo.clickOnImageButton(1);
solo.clickOnImage(1);
So far nothing has worked. Is it possibly because I am clicking the button before the menu has popped up? How can I get Robotium to wait?
It's actually very easy, just click on the view by id:
solo.clickOnView(getActivity().findViewById(R.id.menu_edit));

trigger on texbox got focus

I have virtual keyboard which should be hidden and i want to show it only when textbox get focus. I'm using mvvm so i dont want to write any code on code behind, so i want to make some trigger if it's possible which can watch all texboxes and set visibility on my virtual keyboard.
Or i can do it in controller but i cant find the way how to get current focused control
<DockPanel FocusManager.FocusedElement="{Binding FocusedElement, Mode=TwoWay}"
doesnt work
unfortunately didn't found solution to use triggers but atleast i can get IsFocused value using extension, got it from here Set focus on textbox in WPF from view model (C#)