Search bar corrupted in MAC

Dani_S 3,126 Reputation points


In windos it works but in MAC is corrupted, why?

User's image

  <HorizontalStackLayout Grid.Row="1" Grid.Column="0" Margin="10,10,0,5" HorizontalOptions="Start">

  <SearchBar  x:Name="searchBar" WidthRequest="250" SearchCommand="{Binding PerformSearchCommand}" 

          Placeholder="Search in log file..."   Text="{Binding SearchText, Mode=TwoWay}"/>

  <ImageButton x:Name="cancelCommand" Source="cancel.png" WidthRequest="25" HeightRequest="25"  Command="{Binding CancelSearchCommand}" 

           ToolTipProperties.Text="Cancel serach"/>

A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,089 questions
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 28,071 Reputation points Microsoft Vendor


    When I set WidthRequest for the HorizontalStackLayout, it works.

    <HorizontalStackLayout  WidthRequest="285" Grid.Row="0" Margin="10,10,0,5" HorizontalOptions="Start">

    By the way, the searchbar has its own cancel button on iOS/Maccatalyst platforms, you can hide it.

    // in MauiProgram class
    Microsoft.Maui.Handlers.SearchBarHandler.Mapper.AppendToMapping("CancelButtonColor", (handler, view) =>
    handler.PlatformView.SetShowsCancelButton(false, false);

    Best Regards,

    Wenyan Zhang

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful