我正在编写一个Windows 8.1应用程序(WINRT)。
我已经在页面中实现了一个滚动查看器。它包含一个堆栈面板,它具有带有长文本的richtextblock,以及一个按钮。
但问题是,这个滚动查看器是,根本不是滚动。如果我手动将一个高度设置为这个滚动查看器,那么它正在滚动,但是在更高的分辨率上它看起来很难看。如何使此滚动查看器工作,而不需要手动高度。
<ScrollViewer Name="WhyJoin_User_Content_Scroll"
Margin="0,10,0,10"
VerticalScrollBarVisibility="Auto"
>
<StackPanel Orientation="Vertical">
<RichTextBlock Name="WhyJoin_User_Content_RichTextBlock"
FontWeight="Light"
Margin="20,10,20,0"
Foreground="{StaticResource DefaultTheme_DarkBlueColor}"
FontSize="19"
TextWrapping="Wrap"
TextAlignment="Justify">
<RichTextBlock.Blocks>
<Paragraph>
<Paragraph.Inlines>
<Run Text=" Text Text Text Text Text Text Text Text ">
</Paragraph.Inlines>
</Paragraph>
<Paragraph>
<Paragraph.Inlines>
<Run Text=" Text Text Text Text Text Text Text Text ">
</Paragraph.Inlines>
</Paragraph>
<Paragraph>
<Paragraph.Inlines>
<Run Text=" Text Text Text Text Text Text Text Text "></Run>
</Paragraph.Inlines>
</Paragraph>
<Paragraph>
<Paragraph.Inlines>
<Run Text=" Text Text Text Text Text Text Text Text "></Run>
</Paragraph.Inlines>
</Paragraph>
<Paragraph>
<Paragraph.Inlines>
<Run Text="i: Practice work hours of experts"></Run>
</Paragraph.Inlines>
</Paragraph>
<Paragraph>
<Paragraph.Inlines>
<Run Text="ii: Address, Phone numbers etc."></Run>
</Paragraph.Inlines>
</Paragraph>
<Paragraph>
<Paragraph.Inlines>
<Run Text="iii: Appointment requests"></Run>
</Paragraph.Inlines>
</Paragraph>
<Paragraph>
<Paragraph.Inlines>
<Run Text=" Text Text Text Text Text Text Text Text "></Run>
</Paragraph.Inlines>
</Paragraph>
</RichTextBlock.Blocks>
</RichTextBlock>
<Button
x:Name="ButtonWhyJoin_User_Register"
BorderThickness="0"
Width="150"
Height="70"
Margin="0,10,0,0"
HorizontalAlignment="Center"
Click="ButtonWhyJoin_User_Register_Click"
FontWeight="ExtraLight"
Background="{StaticResource DefaultTheme_DarkBlueColor}"
BorderBrush="{x:Null}"
Style="{StaticResource ButtonStyleYesNo}"
Foreground="{StaticResource DefaultTheme_BackgroundColor}"/>
</StackPanel>
</ScrollViewer>发布于 2015-01-31 12:23:28
解决问题的最简单方法是将滚动查看器的高度和/或宽度绑定到ContentRoot。这是最容易做到的混合,通过这样做,无论屏幕分辨率,你将自动达到所需的高度。
http://pho.to/8kh1T
这就是XAML的样子。
<ScrollViewer HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" Width="175" Height="{Binding ActualHeight, ElementName=ContentRoot}"/> https://stackoverflow.com/questions/28248842
复制相似问题