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.
I got a button that looked like
If I was to replace the button with a standard MAUI one then I would get
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?
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
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
But with SFButtons either we have a button that's too long or a button that cuts off text. Examples below
Is this a temporary issue or is this the way SFButtons are going to work in MAUI going forward?
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
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