全景项目从左向右滑动

时间:2014-07-24 10:42:53

标签: c# .net windows-phone-8

我想制作一个阿拉伯语windows phone 8应用程序,所以我需要让我的全景视图从左向右滑动(英语方向相反)我试过这个

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        MainPanorama.DefaultItem = MainPanorama.Items[1];
        if (!App.ViewModel.IsDataLoaded)
        {
            App.ViewModel.LoadData();
        }
    }

但标题是相反的方向,任何人都有想法?

2 个答案:

答案 0 :(得分:0)

如果您希望下一个全景项目似乎在左侧,那么您可以使用CompositeTransforms。像这样:

<phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Key="PanoramaTitleTemplate">
        <TextBlock Text="{Binding}"
                               FontSize="48"
                               Margin="12,24"
                               RenderTransformOrigin="0.5,0.5">
            <TextBlock.RenderTransform>
                <CompositeTransform ScaleX="-1" />
            </TextBlock.RenderTransform>
        </TextBlock>
    </DataTemplate>

    <DataTemplate x:Key="PanoramaItemHeaderTemplate">
        <TextBlock Text="{Binding}"
                   FontSize="52"
                   MinWidth="380"
                   TextAlignment="Right">
        </TextBlock>
    </DataTemplate>
</phone:PhoneApplicationPage.Resources>

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

    <phone:Panorama Title="Panorama"
                    RenderTransformOrigin="0.5,0.5"
                    TitleTemplate="{StaticResource PanoramaTitleTemplate}">
        <phone:Panorama.RenderTransform>
            <CompositeTransform ScaleX="-1" />
        </phone:Panorama.RenderTransform>

        <phone:PanoramaItem Header="Header1"
                            RenderTransformOrigin="0.5,0.5"
                            HeaderTemplate="{StaticResource PanoramaItemHeaderTemplate}">

            <phone:PanoramaItem.RenderTransform>
                <CompositeTransform ScaleX="-1" />
            </phone:PanoramaItem.RenderTransform>

            <Grid Background="DarkBlue" />
        </phone:PanoramaItem>

        <phone:PanoramaItem Header="Header2"
                            RenderTransformOrigin="0.5,0.5"
                            HeaderTemplate="{StaticResource PanoramaItemHeaderTemplate}">

            <phone:PanoramaItem.RenderTransform>
                <CompositeTransform ScaleX="-1" />
            </phone:PanoramaItem.RenderTransform>

            <Grid Background="DarkCyan" />
        </phone:PanoramaItem>

        <phone:PanoramaItem Header="Header3"
                            RenderTransformOrigin="0.5,0.5"
                            HeaderTemplate="{StaticResource PanoramaItemHeaderTemplate}">

            <phone:PanoramaItem.RenderTransform>
                <CompositeTransform ScaleX="-1" />
            </phone:PanoramaItem.RenderTransform>

            <Grid Background="DarkGoldenrod" />
        </phone:PanoramaItem>
    </phone:Panorama>


</Grid>

答案 1 :(得分:0)

解决方案非常简单,名为“FlowDirection”的全景控件上有一个属性,你可以改变它

<phone:Panorama x:Name="MainPanorama" FlowDirection="RightToLeft">