我有一个自定义图形用户控件,我已将其放置在堆栈面板中。堆栈面板中最多可以随时显示 4 个图形控件。我有复选框来控制图表的可见性。
我遇到的问题是,当我取消选中一个复选框时,堆栈面板中的剩余图形不会调整大小以弥补额外的空间。我正在寻找的是当所有图表都可见时,它们适合屏幕而不滚动,但如果只有一个图表可见,我希望调整它的大小以占用所有房间。
有人有想法么?
这是我到目前为止所拥有的:
<UniformGrid Grid.Row="2" Name="uniformGrid1" >
<UniformGrid.Resources>
<Utilities:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</UniformGrid.Resources>
<StackPanel Grid.Row="1" Height="700" Name="graphControls" Orientation="Vertical">
<!--Cross Correlation Graph-->
<View:Graph Width="Auto" Height="Auto" MinHeight="175" Margin="5" x:Name="CrossCorrelationGraph" x:FieldModifier="public"
Visibility="{Binding Path=IsChecked, ElementName=crossCorrelationViewCheck, Converter={StaticResource BooleanToVisibilityConverter}}"
GraphMetadata="{Binding Path=Processor.CrossCorrelation.CrossCorrelationGraphData}"
StartPointAlignment="CenterVertical"
GraphTitle="Cross Correlation"
IsDetailed="True"/>
<!--Power Spectrum Graph-->
<View:Graph Width="Auto" Height="Auto" MinHeight="175" Margin="5" x:Name="PowerSpectrumGraph" x:FieldModifier="public"
Visibility="{Binding Path=IsChecked, ElementName=powerSpectrumViewCheck, Converter={StaticResource BooleanToVisibilityConverter}}"
GraphMetadata="{Binding Path=Processor.CrossCorrelation.PowerSpectrumGraphData}"
StartPointAlignment="Left"
GraphTitle="Power Spectrum"
IsDetailed="True"/>
<!--Phase Spectrum-->
<View:Graph Width="Auto" Height="Auto" MinHeight="175" Margin="5" x:Name="PhaseSpectrum" x:FieldModifier="public"
Visibility="{Binding Path=IsChecked, ElementName=phaseSpectrumViewCheck, Converter={StaticResource BooleanToVisibilityConverter}}"
GraphMetadata="{Binding Path=Processor.CrossCorrelation.PhaseSpectrumGraphData}"
StartPointAlignment="CenterHorizontal"
GraphTitle="Cross Phase Spectrum"
IsDetailed="True"/>
<!--Amplitude Spectrum-->
<View:Graph Width="Auto" Height="Auto" MinHeight="175" Margin="5" x:Name="AmplitudeSpectrumGraph" x:FieldModifier="public"
Visibility="{Binding Path=IsChecked, ElementName=amplitudeSpectrumViewCheck, Converter={StaticResource BooleanToVisibilityConverter}}"
StartPointAlignment="Left"
GraphTitle="Cross Amplitude Spectrum"
IsDetailed="True"/>
</StackPanel>
</UniformGrid>