xamarin/Xamarin.Forms

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

开放

#8,237 创建于 2019年10月25日

 (1 条评论) (2 个反应) (0 位负责人)C# (1,926 个派生)batch import
a/shell :shell:e/3 :clock3:help wantedinactivet/bug :bug:up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南