Reputation: 672
As we are aware double clicking the tabs on ribbon control opens the menu & keeps it fixed until the user double clicks again on either of the tabs. This basically resizes the row beneath the ribbon. Is there a way by which I can control this resize behavior? I want it to resize it from the upper portion of the row but keep the bottom portion of the row fixed. The purpose of doing this is a user control is placed in the row beneath the ribbon which has a tool bar at the bottom. As a consequence of double clicking the tool bar goes beneath the third row & gets hidden & is visible only when user double clicks on the ribbon again. So if I can control the resize behavior to keep the row fixed from the bottom I would be able to view the toolbar even when user double clicks the ribbon. Is there a way I can achieve this? Any help/suggestion would be appreciated.
Edit: Adding a sample XAML for clearer understanding.
<RibbonWindow>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto/>
<RowDefinition Height="*"/>
<RowDefinition Height=30/>
</Grid.RowDefinitions>
<Ribbon Grid.Row=0/>
<UserControlWithEmbeddedToolbarHere Grid.Row=1/>
<!--The toolbar is embedded within the user control &
placed at the bottom of the user control-->
<StatusBarHere Grid.Row=2/>
</Grid>
</RibbonWindow>
Upvotes: 1
Views: 475
Reputation: 133
Your window should contain a MinHeight in the RowDefinitions, which is the height of the toolbar:
<Window>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*" MinHeight="40"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Ribbon Grid.Row="0">
</Ribbon>
<UserControlHere Grid.Row="1">
</UserControlHere>
<StatusBar Grid.Row="2">
</StatusBar>
</Grid>
</Window>
Your UserControl with toolbar:
<UserControl>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid>
Everything else
</Grid>
<ToolbarHere Grid.Row="1">
</ToolbarHere>
</Grid>
</Window>
In your user control, by specifying a height for your toolbar, you 'ensure' that it'll be given a space in your grid. Height="*" is 'everything else' after "Auto" (which is the space your toolbar needs) has been allocated.
Your window is creating space for the ribbon first, then the statusbar, THEN your usercontrol (because of Height="*"). If your rendered ribbon is (let's just say...) 40 and your status bar is 30 as you mentioned and your window height is 80, your usercontrol will only be of height 10 (80-40-30), thus you might not see your toolbar in your usercontrol.
Consider adding a scrollviewer wrapping your usercontrol, or setting a minimum height to your window.
Upvotes: 2