我有多个树形视图在可展开的控件内,随着内容的增加可以增长高度。但当高度大于窗口大小时,会超出窗口。
显而易见的解决方法是设置Treeview的MaxHeight,但我无法轻松确定它,因为可用高度取决于:
- 窗口高度 - 其他展开器(打开/关闭)
我需要改变什么才能使树形视图的高度仍然自动增长,但永远不会大于窗口的高度?
显而易见的解决方法是设置Treeview的MaxHeight,但我无法轻松确定它,因为可用高度取决于:
- 窗口高度 - 其他展开器(打开/关闭)
我需要改变什么才能使树形视图的高度仍然自动增长,但永远不会大于窗口的高度?
<StackPanel CanVerticallyScroll="True" ClipToBounds="False" Height="Auto" Name="StackPanel2" Width="250" DockPanel.Dock="Left" Orientation="Vertical" VerticalAlignment="Top" CanHorizontallyScroll="False" Margin="5">
<Border BorderThickness="0" CornerRadius="5" Padding="1" BorderBrush="Red" Margin="0,5" >
<Expander Header="Expander3" Height="Auto" IsExpanded="False" Width="Auto" Margin="2" BorderThickness="1">
<Grid Height="Auto" Width="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
<TreeView Height="Auto" BorderThickness="1" Margin="0,0,0,0" Padding="7" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
</TreeView>
</Grid>
</Expander>
</Border>
</StackPanel>