maui
maui copied to clipboard
[MAUI] - iOS SearchBar ignores WidthRequest and HeightRequest property values
Description
The SearchBar control fails to respect explicitly defined Height and Width property values.
Expected Behavior:
- SearchBar should render with the dimensions specified through Height and Width properties
- The control should maintain these defined dimensions regardless of available container space
Android
Actual Behavior:
- SearchBar expands to fill the entire available space in its container
- Explicitly set Height and Width properties are ignored - The control always defaults to the maximum available dimensions
iOS
Mac
Steps to Reproduce
Add the following XAML code
<StackLayout>
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<SearchBar
Placeholder="Search..."
WidthRequest="200"/>
</VerticalStackLayout>
<HorizontalStackLayout>
<SearchBar
Placeholder="Search..."
HeightRequest="200"/>
</HorizontalStackLayout>
</StackLayout>
Observe that:
- The first SearchBar ignores the WidthRequest="200" and spans the full width
- The second SearchBar ignores the HeightRequest="200" and maintains default height
Link to public reproduction project repository
No response
Version with bug
9.0.30 SR3
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
iOS, macOS
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
I'm getting this too. Is there are workaround for now @prakashKannanSf3972 ?
Actually if I do this, it works:
<HorizontalStackLayout WidthRequest="170">
<SearchBar
Text=""
/>
</HorizontalStackLayout>