Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Docking two colappsed StackPanels on top of each other when both get displayed

$
0
0

I have a DockPanel with a docked panel on the right with vertical buttons.

At the moment I have put in placeholders for two of the panels that get displayed when buttons click.

XAML so far:

<DockPanel Grid.Row="1" Grid.RowSpan="4" Grid.Column="2" Margin="2,0,2,2"><StackPanel DockPanel.Dock="Right" Margin="2,0,2,2"><StackPanel.Background><LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"><GradientStop Color="{DynamicResource {x:Static SystemColors.ActiveCaptionColorKey}}"/><GradientStop Color="White" Offset="1"/></LinearGradientBrush></StackPanel.Background><Button x:Name="buttonStudentPicker" Content="Student Picker" HorizontalAlignment="Right" Margin="2,10,2,10" BorderThickness="0,5,0,0" Background="{x:Null}" Click="buttonStudentPicker_Click"><Button.LayoutTransform><RotateTransform Angle="90"/></Button.LayoutTransform></Button><Button x:Name="buttonDemonstrationPicker" Content="Demonstrations Picker" HorizontalAlignment="Right" Margin="2,2,2,10" BorderThickness="0,5,0,0" Background="{x:Null}" Click="buttonDemonstrationPicker_Click"><Button.LayoutTransform><RotateTransform Angle="90"/></Button.LayoutTransform></Button><Button Content="Assignment History" HorizontalAlignment="Right" Margin="2,2,2,10" BorderThickness="0,5,0,0" Background="{x:Null}"><Button.LayoutTransform><RotateTransform Angle="90"/></Button.LayoutTransform></Button><Button Content="Material and Settings" HorizontalAlignment="Right" Margin="2" BorderThickness="0,5,0,0" Background="{x:Null}"><Button.LayoutTransform><RotateTransform Angle="90"/></Button.LayoutTransform></Button></StackPanel><StackPanel x:Name="panelStudentPicker" DockPanel.Dock="Right" Background="Yellow" Width="400" Visibility="Collapsed"></StackPanel><StackPanel x:Name="panelDemonstrationPicker" DockPanel.Dock="Right" Background="Blue" Width="400" Visibility="Collapsed"></StackPanel></DockPanel>

It is doing what I expect. So, for example, if I click on the top two navigation buttons:

But this is how I want them to stack. Ideally:

Ideally, for each of the panels that I choose to display they should equally fit the space, one above the other. Is this possible?



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>