Bug 27686 - SearchBar Focus()
Summary: SearchBar Focus()
Status: RESOLVED INVALID
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.5
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-05 06:35 UTC by Fokke Vermeulen
Modified: 2015-04-01 19:07 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample Project (176.96 KB, application/zip)
2015-03-26 04:15 UTC, Arpit Jha
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Fokke Vermeulen 2015-03-05 06:35:28 UTC
I have a searchbar on a contentpage and want to type in the searchbar if the view is pushed on this contentpage.

The method searchbar.Focus() does not work.

The keyboard will not shown up and the searchbar will not focused :(

Tested it with a Nexus 4, Nexus 5 and Samsung Galaxy S5.

Sample:

public partial class SuggestionSearchPage : ContentPage
    {
        public SuggestionSearchPage()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            InitializeComponent();
            
            suggestionSearchBar.Focus();
        }
    }
Comment 1 Arpit Jha 2015-03-26 04:15:15 UTC
Created attachment 10508 [details]
Sample Project

I have checked this issue and able to reproduce this issue with the help of bug description.

Steps to reproduce:
1.Open attached Sample.
2. Run the sample on android device/Emulator.

Supplement Info:
Screencast: http://www.screencast.com/t/McaNQZpIx
Application output: https://gist.github.com/Arpit360/e542d2b707556107e3f3
XAP device log:   https://gist.github.com/Arpit360/c70eb329909544afe017

Environment Info:
Xamarin.Forms Version: 1.4.0.6341


=== Xamarin Studio ===

Version 5.8 (build 443)
Installation UUID: 3d25a767-a003-4a7d-9f5e-e57987cf6cf0
Runtime:
	Mono 3.12.1 ((detached/b7764aa)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010000

=== Xamarin.Android ===

Version: 4.20.0.37 (Enterprise Edition)
Android SDK: /Users/mac360_xamarin/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.1 (6602)
Build 6A1052c

=== Xamarin.iOS ===

Version: 8.8.0.2 (Enterprise Edition)
Hash: ccfcd59
Branch: 
Build date: 2015-03-10 02:20:32-0400

=== Xamarin.Mac ===

Version: 1.12.0.14 (Enterprise Edition)

=== Build Information ===

Release ID: 508000443
Git revision: 73883239470cbe8e261c94d95f7c3d0452fd393b
Build date: 2015-03-10 07:22:51-04
Xamarin addins: a2ff7b617f09d9c45d8bbf3d010b5db0d7d36100

=== Operating System ===

Mac OS X 10.10.0
Darwin mac360-xamarins-Mac-mini.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 2 Jason Smith [MSFT] 2015-04-01 19:07:30 UTC
Focus cannot be called until the element is part of the visual hierarchy which happens once it is added to a page which is attached to the Application after the LoadApplication call has been made.
Comment 3 Jason Smith [MSFT] 2015-04-01 19:07:50 UTC
Further you will see that Focus is returning false indicating the focus event could not be serviced.