gpt4 book ai didi

xaml - 图像填充按钮 UWP Xaml

转载 作者:行者123 更新时间:2023-12-04 13:16:01 25 4
gpt4 key购买 nike

我在拉伸(stretch)图像以填充按钮时遇到问题,我是 UWP 的新手,这是我的代码:

 <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>

最佳答案

您可能需要更改按钮的 Padding 和 BorderThickness 属性。如下代码:

    <Button Grid.Column="0" Height="39" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Padding="0" BorderThickness="0">
<Image Source="Assets/microsoft.png" Stretch="UniformToFill"/>
</Button>

关于xaml - 图像填充按钮 UWP Xaml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34017031/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com