WPF滚动查看器滚动问题
我目前正在制作一个小样本项目来浏览UI类scrollviewer,这对我来说似乎非常粗糙,因为某些原因,我似乎无法让它滚动到下面是我的布局WPF滚动查看器滚动问题,wpf,scrollviewer,Wpf,Scrollviewer,我目前正在制作一个小样本项目来浏览UI类scrollviewer,这对我来说似乎非常粗糙,因为某些原因,我似乎无法让它滚动到下面是我的布局 <Grid> <Grid.RowDefinitions> <RowDefinition Height="1*"></RowDefinition> <RowDefinition Height="2*"></RowDefinition> <
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
</Grid.RowDefinitions>
<DockPanel Grid.Row="0" Height="70" MinHeight="50px" MinWidth="400px" Dock="Top">
<ScrollViewer Grid.Row="0" Width="300" HorizontalAlignment="Left">
<Grid>
<Tree></Tree>
</TreeView>
</Grid>
</ScrollViewer>
<ScrollViewer Grid.Row="0" Grid.Column="1">
<StackPanel>
<TextBlock Text="RIGHT CONTENT" Style="{StaticResource Heading2}" />
<TextBlock Text="Content goes here" />
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>
。。。。。
<ScrollViewer Grid.Row="0" Width="300" HorizontalAlignment="Left">
<Grid>
<Tree></Tree>
</TreeView>
</Grid>
</ScrollViewer>
<ScrollViewer Grid.Row="0" Grid.Column="1">
<StackPanel>
<TextBlock Text="RIGHT CONTENT" Style="{StaticResource Heading2}" />
<TextBlock Text="Content goes here" />
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>
我不太清楚为什么堆栈面板不会滚动,除非我给滚动查看器添加一个确定的高度。如果我这样做,当我全屏显示或重新调整大小时,滚动查看器将不会展开。我只需点击一个按钮就可以将列表加载到树中,但无论我使用什么布局,它都不会滚动
<ScrollViewer Grid.Row="0" Width="300" HorizontalAlignment="Left">
<Grid>
<Tree></Tree>
</TreeView>
</Grid>
</ScrollViewer>
<ScrollViewer Grid.Row="0" Grid.Column="1">
<StackPanel>
<TextBlock Text="RIGHT CONTENT" Style="{StaticResource Heading2}" />
<TextBlock Text="Content goes here" />
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>
这也在从另一个只包含Iframe的窗口导航到的页面中。您是否尝试在SrollViewer上将VerticalScrollMode属性设置为Enabled?显然,我在放置页面的主窗口中设置整体布局时犯了一个错误,导致内容无法显示可滚动。我将我的框架包装在一个网格中,并进行了行定义,它成功了
<ScrollViewer Grid.Row="0" Width="300" HorizontalAlignment="Left">
<Grid>
<Tree></Tree>
</TreeView>
</Grid>
</ScrollViewer>
<ScrollViewer Grid.Row="0" Grid.Column="1">
<StackPanel>
<TextBlock Text="RIGHT CONTENT" Style="{StaticResource Heading2}" />
<TextBlock Text="Content goes here" />
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>
哦,嵌套ui的乐趣 你能澄清你的ScrollViewer是否在一个没有在你发布的XAML中显示的网格中吗?如果它们的父对象是DockPanel,那么它们的行和列值将不会起任何作用。
<ScrollViewer Grid.Row="0" Width="300" HorizontalAlignment="Left">
<Grid>
<Tree></Tree>
</TreeView>
</Grid>
</ScrollViewer>
<ScrollViewer Grid.Row="0" Grid.Column="1">
<StackPanel>
<TextBlock Text="RIGHT CONTENT" Style="{StaticResource Heading2}" />
<TextBlock Text="Content goes here" />
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>