SFButton not respecting HorizontalOptions and VerticalOptions

Hello,

I am migrating one of our Xamarin.Forms apps to MAUI but we are encountering layout issues with SFButtons.

In Xamarin.Forms SFButton, setting the HorizontalOptions and VerticalOptions would alter that buttons position. However in MAUI it looks like setting these properties does not change the buttons position. 

I created a new MAUI project and installed the latest version of Syncfusion.Maui.Buttons (23.1.38). I removed all the default code and added a Grid and a SFButton. I set the HorizontalOptions and VerticalOptions so that the button would be at the top right of the page. 


image

I got a button that looked like

image


If I was to replace the button with a standard MAUI one then I would get     

image

image


I tried the exact same thing in Xamarin.Forms and it renders the same as the default MAUI button. 

Is this the expected behaviour of the MAUI version of SFButton? If so then how do we set the position of the button?


4 Replies 1 reply marked as answer

BV Brundha Velusamy Syncfusion Team September 27, 2023 02:14 PM UTC

Hi Callum Terris,


We recommend that you set the HeightRequest and WidthRequest to SfButton to overcome the reported issue as shown in the code snippet. We have created the sample based on this and attached it for your reference. Please let us know if you need any other details.


Please refer the below code snippet for this,

<Grid >

 

        <buttons:SfButton x:Name="SfButton"

                          WidthRequest="200"

                          HeightRequest="40"

                          HorizontalOptions="End"

                          VerticalOptions="Start"

                          Text="Button"                        

                          FontAttributes="Bold"/>

 

</Grid>


Regards,

Brundha V


Attachment: ButtonSample_789ed4eb.zip


CT Callum Terris September 28, 2023 01:03 PM UTC

So with that can we no long dynamically resize our buttons with the content inside them like we used to? We have to explicitly set the Width and Height?

We support multiple languages, so a button in one language might be one size but might be completely different in other languages. Are you saying we have to go through all our buttons in every language and calculate the size? I get we can probably calculate it with code but having it work like that by default was very nice.

It appears to be working on fine with the default MAUI buttons

Image_3325_1695905121429

Image_7996_1695905132711


But with SFButtons either we have a button that's too long or a button that cuts off text. Examples below

Image_5090_1695906110582

 Image_8360_1695906063668



Is this a temporary issue or is this the way SFButtons are going to work in MAUI going forward?



BV Brundha Velusamy Syncfusion Team October 4, 2023 02:05 PM UTC

Hi Callum,

 

We have fixed the reported issue "SFButton not respecting HorizontalOptions and VerticalOptions". At present, a custom patch has been created for version 23.1.39. We have attached the NuGet file for your convenience.

 

Please note that we have created this patch for version 23.1.39 specifically to resolve the issue reported in this ticket. If you have received other patches for the same version for other products, please apply all patches in the order received.

 

Note: Please refer to the below link to apply the custom patch.

https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache

 

We will include the fix in our upcoming weekly release on October 17, 2023. We appreciate your patience until then.

 

Disclaimer: The inclusion of this solution in the weekly release may change due to other factors, including but not limited to QA checks and work reprioritization.

 

Regards,

Brundha V


Attachment: Syncfusion.Maui.Buttons.23.1.39_99e0db08.zip

Marked as answer

BV Brundha Velusamy Syncfusion Team October 17, 2023 06:56 AM UTC

Hi Callum,

 

Thanks for your patience.

 

We have included the fix for the reported issue "SFButton not respecting HorizontalOptions and VerticalOptions" in our latest weekly NuGet release v23.1.41 which is available for download ( https://www.nuget.org/ ). We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you would require any further assistance.

 

Regards,

Brundha V


Loader.
Up arrow icon