Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image filling a button UWP Xaml

I am having problem in stretching my image to fill the button,I am new in UWP this is my code:

 <Grid  Margin="0,0,0,54" VerticalAlignment="Bottom" Height="39" Style="{Binding HorizontalAlignment, ElementName=grid}" ScrollViewer.HorizontalScrollBarVisibility="Auto">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Button Grid.Column="0"  Height="39" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
            <Image Source="images/icon1.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="True" d:LayoutRounding="Auto" />

        </Button>
        <Button Grid.Column="1"  Height="39" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
            <Image Source="images/icon2.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="True" d:LayoutRounding="Auto" />
        </Button>

</Grid>
like image 453
user3821206 Avatar asked Dec 01 '15 09:12

user3821206


1 Answers

You probably need to change the Padding and BorderThickness properties of the button. As code below :

    <Button Grid.Column="0" Height="39" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Padding="0" BorderThickness="0">
        <Image Source="Assets/microsoft.png" Stretch="UniformToFill"/>
    </Button>
like image 198
Jean-Sébastien Dupuy Avatar answered Oct 19 '22 21:10

Jean-Sébastien Dupuy