如何在一个 WPFGrid
内水平拉伸 WPF RibbonGroup
?尽管HorizontalAlignment
有财产,但它并没有伸展。
<Window x:Name="FrmMain" x:Class="PhotoCell.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="PhotoCell" Height="386.821" Width="757.701" WindowState="Maximized">
<Grid>
<Image x:Name="imgMain" Margin="10,142,10,9"/>
<Ribbon VerticalAlignment="Top">
<RibbonTab Header="Home" Height="88" VerticalAlignment="Top">
<RibbonGroup Header="Save/Load" Height="88" Margin="0" VerticalAlignment="Top" Width="90">
<Grid HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<RibbonButton x:Name="cmdLoadImage" Background="#FFFFC500" Label="Load" Click="cmdLoadImage_Click" Margin="10,10,10,0" Grid.Row="0" HorizontalAlignment="Stretch" />
<RibbonButton x:Name="cmdSaveImage" Background="#FFFFC500" Label="Save" Click="cmdSaveImage_Click" Margin="10,10,10,0" Grid.Row="1" HorizontalAlignment="Stretch" />
</Grid>
</RibbonGroup>
</RibbonTab>
</Ribbon>
</Grid>
</Window>
我也试过添加
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
在行定义之后。