xamarin-forms-docs/knowledge-base/button-image-and-text.md

1.4 KiB

title description type page_title slug position tags ticketid res_type
How to align image and text to the RadButton aligh image and text inside button how-to How to add image and text to the RadButton button-image-and-text button, xamarin, image, text, align, XamarinForms 1424187 kb

Environment

Product Version 2019.2.802.1
Product Button for Xamarin Cross-Platform

Description

This article shows how to add image and text to Button and how to align them.

Solution

RadButton inherits from the Xamarin.Forms Button, so in order to align image and text inside the RadButton control you should use the ContentLayout property of the Button.

  • ContentLayout Defines an object that controls the position of the button image and the spacing between the button's image and the button's text. For more details - check the Xamarin.Forms API Reference.

Example

<telerikInput:RadButton x:Name="rb"
                        Text="Text"
                        Image="image.png"
                        ContentLayout="top,10"/>

where the image is positioned on the top of the button and the spacing between the button's image and button's text is 10.