带有ScrollViewer和VerticalScrollBarVisibility的弹出窗口=自动在3.5sp1中无法正确显示 [英] Popup with ScrollViewer and VerticalScrollBarVisibility=Auto not displaying correctly in 3.5sp1
本文介绍了带有ScrollViewer和VerticalScrollBarVisibility的弹出窗口=自动在3.5sp1中无法正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有一个包含ScrollViewer的Popup,并且我设置了VerticalScrollBarVisibility = Auto,则如果需要滚动条,则Popup的大小将不正确.看来它已在4.0中修复. (至少我的测试用例在2010年有效,而在2008年无效),但是 我希望2008年有一个解决方法,因为我现在还不能移动到2010年.这是一些显示问题的XAML示例
If I have a Popup which contains a ScrollViewer and I set VerticalScrollBarVisibility=Auto, if the scroll bar is required the Popup is not sized correctly. This looks like it was fixed in 4.0 ( at least my test case works in 2010 and not 2008 ) but I'm hoping there's a workaround for 2008 since I can't move to 2010 yet. Here's some example XAML which shows the issue
<Window
x:Class="CommandTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CommandTest"
Title="Window1" Height="300" Width="300">
<Grid>
<ToggleButton x:Name="button" VerticalAlignment="Center" HorizontalAlignment="Center">Press Me</ToggleButton>
<Popup StaysOpen="False" IsOpen="{Binding ElementName=button, Path=IsChecked}" PlacementTarget="{Binding ElementName=button}" Placement="Right">
<Border
BorderBrush="DimGray"
Background="LightBlue"
Padding="3"
Grid.IsSharedSizeScope="True">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock>This is a header of some sort</TextBlock>
<Border Grid.Row="1" Height="2000" Margin="3" BorderBrush="DimGray" Background="AliceBlue"/>
</Grid>
</ScrollViewer>
</Border>
</Popup>
</Grid>
</Window>
推荐答案
它似乎稍微复杂一些-在我的应用程序中,弹出窗口没有即使我确实没有设置滚动条,即使我没有设置VerticalScrollBarVisibility = Auto也无法正确显示.我无法对此做一个简单的复制案例,但我猜 它与同一个核心问题有关.
It's apparently slightly more complicated - in my app the popup doesn't display properly even if I don't set VerticalScrollBarVisibility=Auto if the scroll bars are actually needed. I haven't been able to make a simple repro case of this but I'm guessing it's related to the same core issue.
这篇关于带有ScrollViewer和VerticalScrollBarVisibility的弹出窗口=自动在3.5sp1中无法正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文