Aligning button image next to text

Hi,

Is there a way to align the images next to the button text (and also support the RTL) without setting the content of the button as explained in here?

 


When we set the content, we lose the buttons intrinsic features like VisualStateManagement, so I don't want to use this feature. As much as I read, I see that you image alignment options don't support this case, but I hope I am missing something and there is a way to support this. 


Thanks in advance

Sinan


5 Replies 1 reply marked as answer

VV Vijayakumar Viswanathan Syncfusion Team November 29, 2022 03:20 PM UTC

Hi Sinan,


Thanks for contacting Syncfusion support.


We have checked the working of the VisualStateManager when the content of SfButton is set and it was working properly. We have prepared a sample by using the Content property for achieving the required behavior "Images next to the button text" and it was working properly along with VisualStateManager feature. It will also support the RTL. Please check the attached sample and let us know the details.


Regards,

Vijayakumar V


Attachment: ButtonImage_1ab2ba72.zip


OS Osman Sinan Guven December 6, 2022 04:45 AM UTC

Thanks for the reply Vijayakumar.


And sorry for my late reply. I have checked out your sample. However, the BackgroundColor comes from the button and we can control it in the VisualState. But what about the image or label? I cannot access them from the VisualState, since they are in the Content.


Sinan



VV Vijayakumar Viswanathan Syncfusion Team December 6, 2022 01:16 PM UTC

Hi Sinan


Query: I cannot access them from the VisualState, since they are in the Content.


We have prepared a workaround for accessing the Label and the Image in the button content by binding the Label and the Image with the SfButton and it works along with the Visual State Manager. If you want to change any property, change it like this. Please check the attached sample and let us know the details.



Attachment: ButtonImage_c3fd27a6.zip

Marked as answer

OS Osman Sinan Guven December 6, 2022 10:14 PM UTC

Hi Vijayakumar,


Thanks so much for the sample. Yes, that will work for me!


Sinan



VV Vijayakumar Viswanathan Syncfusion Team December 7, 2022 04:05 PM UTC

Hi Sinan,

Thanks for the update.

We are glad to hear that the sample satisfies your requirement. Please let us know if you need any further assistance.


Regards,

Vijayakumar


Loader.
Up arrow icon