我有两个按钮,里面的图像如下:
<Button Click="OpenIdFamily" Width="130" Margin="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image x:Name="showId" Source="Resources/Logo/id.png" Height="25" UseLayoutRounding="True" />
<TextBlock Text="Fiche identitée" TextWrapping="Wrap" Grid.Column="1" VerticalAlignment="Center" Margin="0" Padding="3,0,0,0"/>
</Grid>
</Button>
我得到了我的预期,但是当我调整窗口大小时,图像滑出按钮(参见两张图片)
感谢您的帮助!
编辑:完整的GUI
这是我的xaml代码:
<Grid Grid.Row="1" Grid.Column="1" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button Click="OpenIdFamily" Width="130" Margin="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image x:Name="showId" Source="Resources/Logo/id.png" Height="25" UseLayoutRounding="True" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBlock Text="Fiche identitée" TextWrapping="Wrap" Grid.Column="1" VerticalAlignment="Center" Margin="0" Padding="3,0,0,0"/>
</Grid>
</Button>
<Button Grid.Row="1" Margin="2" Click="ShowHistoric" HorizontalContentAlignment="Center" HorizontalAlignment="Center">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MaxWidth="25"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image x:Name="ShowHistory" Height="25" Source="Resources/Logo/history.png" />
<TextBlock Text="Historique" Grid.Column="1" VerticalAlignment="Center" Padding="3,0,0,0"/>
</Grid>
</Button>
</Grid>