簡體   English   中英

滾動查看器不滾動沒有高度

[英]Scrollviewer not scrolling without height

我正在編寫Windows Phone 8.1應用程序(WINRT)。

我已經在頁面中實現了scrollviewer 它包含一個帶有帶有長文本richtextblock和一個按鈕堆棧面板

但是問題在於此scrollviewer根本沒有滾動 如果我手動為此滾動查看器設置一個高度 ,它正在滾動,但是在更高的分辨率下看起來很難看。 如何在沒有手動高度的情況下使此scrollviewer工作。

<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>

解決問題的最簡單方法是將滾動查看器的高度和/或寬度綁定到ContentRoot。 這是在Blend中最簡單的方法,無論屏幕分辨率如何,您都會自動達到所需的高度。

http://pho.to/8kh1T

這就是XAML的樣子

<ScrollViewer HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top" Width="175" Height="{Binding ActualHeight, ElementName=ContentRoot}"/> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM