Bug 39409 - SearchBar.SearchCommand does not respect CanExecute
Summary: SearchBar.SearchCommand does not respect CanExecute
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-03-07 13:33 UTC by Mark Smith
Modified: 2016-04-25 17:23 UTC (History)
5 users (show)

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

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:

Description Mark Smith 2016-03-07 13:33:54 UTC
1. Add a SearchBar to a Xamarin.Forms app
2. Bind the SearchCommand to a Command.
3. Set the Command's CanExecute to always return false.
4. Run the app and issue a search result - the Command is invoked.

Because the Command.CanExecute is returning false, the Command should not be invoked. In addition, the SearchBar should wire up to the CanExecuteChanged handler and properly enable and disable the search bar in the native platform as it changes.
Comment 1 Jason Smith [MSFT] 2016-03-11 11:21:12 UTC
Should be fixed in 2.2.0-pre1
Comment 2 Parmendra Kumar 2016-04-25 17:23:17 UTC
I have checked this issue with X.F 2.2.0-pre4 and its working fine. To reproduce and verify this issue I have used sample project.

SampleCode: https://gist.github.com/Parmendrak/4c9cf8883b447e7d6c8566a13f093398

Hence closing this issue.