Windows Phone 7 滚动查看器问题 [英] Windows phone 7 scrollviewer problem

查看:64
本文介绍了Windows Phone 7 滚动查看器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在 wp7 中滚动页面.即使我添加了滚动视图,它仍然不起作用.

I am not able to scroll through the page in wp7 . eventhough i have added scrollview it still doesnt work.

<phone:PhoneApplicationPage 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="860"
x:Class="sastadeal.PhonePage1"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
Orientation="Portrait"
shell:SystemTray.IsVisible="True" Height="1768">

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent" Height="1768">
    <ScrollViewer>

        <!--TitlePanel contains the name of the application and page title-->
<!--TitlePanel contains the name of the application and page title-->

    <Grid x:Name="ContentPanel" Margin="24,8,0,-8" Background="#FF61B1DE" Height="1768" >

        <Image Height="76" Margin="8,8,0,0" Source="logo.png" Stretch="Fill" VerticalAlignment="Top"/>

        <TextBlock HorizontalAlignment="Left" Margin="35,124,0,0" TextWrapping="Wrap" Text="Account Purpose" VerticalAlignment="Top" Foreground="Black"/>
        <ListBox x:Name="lb" Height="70" Margin="36,161,185,0" VerticalAlignment="Top" FontSize="24" Background="#FF00BEEF">
            <ListBoxItem x:Name="lb_vendor" Content="Launch &amp; Grab Deals"/>
            <ListBoxItem x:Name="lb_customer" Content="Grab Deals"/>
        </ListBox>
        <TextBlock HorizontalAlignment="Left" Margin="32,252,0,0" TextWrapping="Wrap" Text="Enter You Vendor Code" Foreground="Black" VerticalAlignment="Top" Name="Vendorcode_tb"/>
        <TextBox x:Name="vendorcode_text" HorizontalAlignment="Left" Margin="21,283,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="334" />
        <TextBlock HorizontalAlignment="Left" Margin="35,363,0,0" TextWrapping="Wrap" Text="e-Mail ID-" Foreground="Black" VerticalAlignment="Top"/>
        <TextBox HorizontalAlignment="Left" Margin="21,390,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="334"/>
        <TextBlock HorizontalAlignment="Left" Margin="32,466,0,0" TextWrapping="Wrap" Text="Enter Password - " Foreground="Black" VerticalAlignment="Top"/>
        <TextBox x:Name="pwd" HorizontalAlignment="Left" Margin="21,497,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="335"/>
        <TextBox x:Name="pwdr" HorizontalAlignment="Left" Margin="21,596,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="335"/>
        <TextBlock HorizontalAlignment="Left" Margin="32,569,0,0" TextWrapping="Wrap" Text="Re-enter password" Foreground="Black" VerticalAlignment="Top"/>
        <TextBlock HorizontalAlignment="Left" Margin="35,669,0,0" TextWrapping="Wrap" Text="Contact Number -" VerticalAlignment="Top" Foreground="Black"/>
        <TextBox x:Name="Cno_txt" HorizontalAlignment="Left" Margin="21,700,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="335" InputScope="Number"/>
        <TextBlock HorizontalAlignment="Left" Margin="36,776,0,0" TextWrapping="Wrap" Text="Mobile Number- " Foreground="Black" VerticalAlignment="Top"/>
        <TextBox x:Name="mno_text" HorizontalAlignment="Left" Margin="21,807,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="335"/>
        <TextBlock HorizontalAlignment="Left" Margin="30,898,0,0" TextWrapping="Wrap" Text="Address 1" Foreground="Black" VerticalAlignment="Top"/>
        <TextBox HorizontalAlignment="Left" Margin="36,950,0,0" TextWrapping="Wrap" Text="" x:Name="add1_text" Width="335" InputScope="PostalAddress" Height="72" VerticalAlignment="Top"/>
        <TextBlock HorizontalAlignment="Left" Margin="36,1026,0,0" TextWrapping="Wrap" Text="Address 2" Foreground="Black" VerticalAlignment="Top"/>
        <TextBox HorizontalAlignment="Left" Margin="36,1057,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="335"/>

    </Grid>
    </ScrollViewer>
</Grid>

屏幕会自动返回到之前的位置并且滚动未完成.它只是向下移动然后像弹性一样返回

The Screen automatically goes back to its previous location and the scroll is not complete. It just moves down and than back again like an elastic

推荐答案

你的 Grid,它是 ScrollViewer 的唯一子元素,具有 1768 的固定高度.这决定了 ScrollViewer 可以向上/向下滚动的最大区域.

Your Grid, that is the only child of the ScrollViewer, has a fixed height of 1768. That determines the maximum area that can be scrolled up/down by the ScrollViewer.

默认情况下,您的 ScrollViewer 会拉伸以适合其父级.该父元素是另一个 Grid,其高度也固定为 1768.

Your ScrollViewer stretches to fit its parent by default. That parent is another Grid that also has a fixed height of 1768.

因此 ScrollViewer 的高度也是固定的 1768,所以没有什么可以滚动的. 可滚动的数量是 ScrollViewer 高度和内容高度.在这种情况下,差异为 0.

Therefore the ScrollViewer has a fixed height of 1768 as well, so there is nothing to scroll. The amount available to scroll is the difference between the ScrollViewer height and the content height. In this case the difference is 0.

去掉外格的固定高度.我怀疑你的 Windows Phone 有 1768 高的屏幕 :)

Remove the fixed height of the outer Grid. I doubt your Windows Phone has a 1768 high screen :)

这篇关于Windows Phone 7 滚动查看器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆