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

Can I make my panel have the same width as the hidden expander children?

$
0
0

I will show you visually first. Here is my panel when it is first displayed:

When you click the expander, it then looks like this:

Then, if you go to hide the controls the panel goes back to the original size.

I would like my panel to have a constant width. Can it take into account the expander data controls?

Here is the XAML:

<StackPanel x:Name="panelStudentPicker" Grid.Row="0" Background="WhiteSmoke" Margin="2,2,2,10"
                                Visibility="{Binding IsChecked, ElementName=buttonStudentPicker, Converter={StaticResource BoolToVis}, FallbackValue=Collapsed}"><Label Content="Student Picker" Background="LightSkyBlue" /><DataGrid x:Name="gridStudents" MinHeight="200" Margin="2"><DataGrid.Columns><DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Name"/><DataGridTextColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Header="Others to be added"/></DataGrid.Columns></DataGrid><StackPanel Orientation="Horizontal" Margin="2,2,2,10"><TextBox MinWidth="100"></TextBox><Label>Search icon</Label></StackPanel><Expander Header="More Options"><StackPanel><GroupBox Header="Publishers"><UniformGrid Columns="3" Rows="1"><Button Content="Add" Margin="2"/><Button Content="Edit" Margin="2"/><Button Content="Delete" Margin="2"/></UniformGrid></GroupBox><GroupBox Header="Filter"><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="1*" /><ColumnDefinition Width="1*" /><ColumnDefinition Width="1*" /></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition Height="1*"/><RowDefinition Height="1*"/><RowDefinition Height="1*"/></Grid.RowDefinitions><Grid.Resources><Style TargetType="{x:Type CheckBox}"><Setter Property="Margin" Value="2" /></Style></Grid.Resources><CheckBox Grid.Column="0" Grid.Row="0" Content="Brother"/><CheckBox Grid.Column="0" Grid.Row="1" Content="Sister"/><CheckBox Grid.Column="0" Grid.Row="2" Content="Never Assigned"/><CheckBox Grid.Column="1" Grid.Row="0" Content="Elder"/><CheckBox Grid.Column="1" Grid.Row="1" Content="Ministerial Servant"/><CheckBox Grid.Column="1" Grid.Row="2" Content="Not Appointed"/><CheckBox Grid.Column="2" Grid.Row="0" Content="Demonstration"/><CheckBox Grid.Column="2" Grid.Row="1" Content="Regular Pioneer"/></Grid></GroupBox></StackPanel></Expander></StackPanel>

I appreciate your assistance in resolvingthis matter.

Thank you.



Viewing all articles
Browse latest Browse all 18858

Trending Articles



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