xamarin/Xamarin.Forms

[Shell] Unable to set text outside constructor and OnAppearing in search bar

Aperta

#8237 aperta il 25 ott 2019

 (1 commento) (2 reazioni) (0 assegnatari)C# (1926 fork)batch import
a/shell :shell:e/3 :clock3:help wantedinactivet/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Description

Is not possible to set a text in search bar of shell menu outside the constructor and OnAppearing methods.

OBSERVATION: In this example, I tested the monkeys page. ShellSearchBarTextIssue.zip

Steps to Reproduce

  1. In <Shell.SearchHandler> tag of the page set a name for the Search Handler control (x:name), for example x:name="searchTest".
  2. In the .cs file override the OnAppearing method set the query property of the search handler, for example searchTest.Query="Test". It works well as expected.
  3. Repeat the step 2 for the constructor of the .cs file.
  4. Create a button anywhere on the page and create a click event.
  5. Set the query property of the search handler in the click event, for example searchTest.Query="Test";.

Expected Behavior

The search bar displays the text setting in the click event.

Actual Behavior

The search bar does not show the text setted.

Basic Information

  • Version with issue: Xamarin.forms.dll 4.3.0.908675
  • Last known good version: 4.3.0.908675
  • IDE: Visual Studio Professional 2019.
  • Platform Target Frameworks:
    • Android: API 22 above.
  • Android Support Library Version: 5.1 above.
  • Nuget Packages: Xamarin.Forms.dll 4.3.0.908675
  • Affected Devices: Samsung Galaxy S6, S7, S8 Plus, S10 plus, Motorola Moto E Play.

Screenshots

Reproduction Link

https://github.com/JeysonGustavo/ShellSetSearchText

Take a look at the MonkeysPage

Guida contributor