Skip to content

SearchBar ShowsCancelButton iOS platform-specific Bindable Property #20919

Description

@darrabam

Description

To be able to set the SetShowsCancelButton property for SearchBar on iOS, without the need to have custom handlers.

Public API Changes

<ContentPage ... xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls"> <StackLayout> <SearchBar ios:SearchBar.ShowsCancelButton="False" Placeholder="Enter search term" /> ... </StackLayout> </ContentPage>

Intended Use-Case

There many cases where you simply do not want to show the "cancel" button. Currently this can be achieved using handlers

#if IOS SearchBarHandler.Mapper.AppendToMapping("CancelButtonColor", (handler, view) => { handler.PlatformView.SetShowsCancelButton(false, false); }); #endif

However, since many developers elect to disable it, it would be nice to have it readily available as a bindable property.

Activity

  1. locked and limited conversation to collaborators on Feb 29, 2024
  2. converted this issue into a discussion #20924 on Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions