在我的主窗口上,我有一个带有许多按钮的工具栏。一旦通过拖动父窗口来调整其大小,以使整个工具栏及其所有按钮不再适合窗口的宽度,整个工具栏就会消失。
有没有一种方法可以让你在调整它的大小时,当你到达工具栏的宽度时,窗口的内部控件停止调整大小并保持显示,只是切断窗口调整大小的位置?
代码是
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ToolBar Grid.Row="1" Height="50" Name="tbMainToolbar" VerticalAlignment="Top" MinWidth="900" >
<ToolBar.Background>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="White" Offset="0.0" />
<GradientStop Color="#DCEBFF" Offset="0.25" />
<GradientStop Color="#99CCFF" Offset="0.75" />
<GradientStop Color="#99CCFF" Offset="1.0" />
</LinearGradientBrush>
</ToolBar.Background>
<DockPanel LastChildFill="True">
<Button Name="btnApproved" DockPanel.Dock="Left" Click="btnToolbar_Click" CommandParameter="APPROVED"
Style="{StaticResource ToolbarButtonDisplay}" HelperClasses:ButtonProperties.Image="..\..\Resources\Images\APPROVEU.GIF" Content="Approve">
</Button>
... and so forth for about 20 buttons