Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 7 锁定全景图标题/图像_Windows Phone 7_Windows Phone 7.1 - Fatal编程技术网

Windows phone 7 锁定全景图标题/图像

Windows phone 7 锁定全景图标题/图像,windows-phone-7,windows-phone-7.1,Windows Phone 7,Windows Phone 7.1,有没有办法锁定全景控件的标题,使其在切换页面时不会滑动?取而代之的是,它保持在原来的位置上?我可能会将全景图放在一个有两行的网格中。第一行可以包含文本、图像或任何要保持静态的内容。然后将全景控件放置在第二行的内部。看看这个: <Grid x:Name="LayoutRoot"> <Grid.RowDefinitions> <RowDefinition Height="60"/> <RowDefinition H

有没有办法锁定全景控件的标题,使其在切换页面时不会滑动?取而代之的是,它保持在原来的位置上?

我可能会将全景图放在一个有两行的网格中。第一行可以包含文本、图像或任何要保持静态的内容。然后将全景控件放置在第二行的内部。看看这个:

<Grid x:Name="LayoutRoot">
    <Grid.RowDefinitions>
         <RowDefinition Height="60"/>
         <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Image x:Name="Logo" Grid.Row="0"/>
    <controls:Panorama Grid.Row="1" Margin="0,-60,0,0">
         <controls:Panorama.Title><Rectangle Height="60"/></controls:Panorama.Title>
    ...
    </controls:Panorama>
</Grid>

...

如果我正确理解了您的意思,您就不想在《全景》中使用paralax标题层

如果是,请尝试以下方法:

public class NoParalaxTitleLayer : PanningTitleLayer
    {
        protected override double PanRate
        {
            get { return 0d; }
        }
    }

    public class NoParalaxBackgroundLayer : PanningBackgroundLayer
    {
        protected override double PanRate
        {
            get { return 1d; }
        }
    }
风格:

<Style x:Key="NonParalaxPanorama" TargetType="controls:Panorama">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="controls:Panorama">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <local:NoParalaxBackgroundLayer x:Name="BackgroundLayer" 
                 HorizontalAlignment="Left" Grid.RowSpan="2">
                                <Border x:Name="background" 
                    Background="{TemplateBinding Background}" 
                    CacheMode="BitmapCache"/>
                            </local:NoParalaxBackgroundLayer>
                            <local:NoParalaxTitleLayer x:Name="TitleLayer" 
                 CacheMode="BitmapCache" 
                 ContentTemplate="{TemplateBinding TitleTemplate}" 
                 Content="{TemplateBinding Title}" 
                 FontSize="187" 
                 FontFamily="{StaticResource PhoneFontFamilyLight}" 
                 HorizontalAlignment="Left" 
                 Margin="10,-76,0,9" Grid.Row="0"/>
                            <controlsPrimitives:PanningLayer x:Name="ItemsLayer" 
                 HorizontalAlignment="Left" Grid.Row="1">
                                <ItemsPresenter x:Name="items"/>
                            </controlsPrimitives:PanningLayer>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

<controls:Panorama Style="{StaticResource NonParalaxPanorama}">
</controls:Panorama>


这看起来几乎可以工作了,但全景的背景将被向下推,而不是在徽标下。但是,这种方法似乎可以在没有任何行定义的情况下工作。。对吗?你可以在全景图上应用负的上边距。我会更新我的答案。