<StackLayout Margin="0,20,0,0">
<buttons:SfButton x:Name="appleLoginButton"
ImageSource="apple_logo.jpg"
Text="Sign In with Apple"
ShowIcon="True"
HorizontalOptions="Center"
ImageAlignment="Start"/>
<buttons:SfButton x:Name="appleLoginButton1"
ImageSource="apple_logo.jpg"
Text="Sign In with Apple"
ShowIcon="True"
HorizontalOptions="Center"
ImageAlignment="End"/>
</StackLayout> |
I have a similar issue. I want to use FillAndExpand for HorizontalOptions for the button (the button should be the width the the view. I want the Image to be aligned with the text (e.g. adjacent within 10px or so). Now, the image (whether ImageAlignment is left or right) is aligned on the far side.
<syncfusion:SfButton x:Name="appleLoginButton"
ImageSource="apple_logo.jpg"
Text="Sign In with Apple"
ShowIcon="True"
HorizontalOptions="FillAndExpand"
ImageAlignment="Start"
HorizontalTextAlignment="Start"/> |
You suggestion works fine if I wanted the text to not be centered. I want the text to be centered on the button with the graphic close to the button. Here is my code:
<sf:SfButton
Command="{Binding StartTicket}"
HorizontalOptions="FillAndExpand"
HorizontalTextAlignment="Center"
ImageAlignment="Start"
IsVisible="{Binding IsOpenTicket, Converter={StaticResource InvertedBoolConverter}}"
ShowIcon="True"
Style="{StaticResource CivicSfButton}"
Text="Start ticket"
TextColor="White">
<sf:SfButton.ImageSource>
<FontImageSource
FontFamily="RegularIcon"
Glyph="{StaticResource Clock}"
Color="White" />
</sf:SfButton.ImageSource>
</sf:SfButton>
Changing HorisontalTextAlignment to Start moves the text to the left - not centered.
<syncfusion:SfButton>
<syncfusion:SfButton.Content>
<StackLayout Margin="4"
HorizontalOptions="CenterAndExpand"
Orientation="Horizontal">
<Image Source="apple_logo.jpg"
HeightRequest="30"
WidthRequest="30"
HorizontalOptions="Center"
VerticalOptions="Center"/>
<Label Text="Start ticket"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</StackLayout>
</syncfusion:SfButton.Content>
</syncfusion:SfButton> |