在semantizoom里面的gridview里面的Flipview

时间:2014-11-20 11:08:14

标签: c# windows xaml gridview flipview

我在semanticzoom里面的gridview里面有一个flipview。 gridview就在那里,因为我无法直接在翻译视图中嵌入flipview。在flipview内我显示全屏图像。用户点击图像,图像描述可见性从可见切换到colappsed。当我在图像上用鼠标左键单击它时,它被“选中”(它会被推到背景中一点点),然后保持选中状态直到我用鼠标右击(它被推回到forground)。我已禁用在gridview上选择,而flipview无法选择项目(我认为)。我希望选择行为停止,但我不知道是什么导致它。 这只是一个不完整的示例,而不是完整的完整代码

<SemanticZoom Name="ModalGallerySemanticZoom" Padding="0" Margin="0" Visibility="Collapsed" ViewChangeStarted="ModalGallerySemanticZoom_ViewChangeStarted"  ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"  Grid.Row="0" Grid.RowSpan="3" Grid.ColumnSpan="3">
        <SemanticZoom.ZoomedInView>
            <GridView Name="ZoomedInGridView" IsItemClickEnabled="False" ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.VerticalScrollMode="Disabled" SelectionMode="None" IsHoldingEnabled="False" IsSwipeEnabled="False" CanReorderItems="False" CanDragItems="False" VerticalAlignment="Center" HorizontalAlignment="Left" Padding="0" Margin="0" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
                <GridView.ItemContainerStyle >
                    <Style TargetType="GridViewItem">
                        <Setter Property="HorizontalContentAlignment" Value="Left"/>
                    </Style>
                </GridView.ItemContainerStyle>
                <Grid Margin="-5,-5,0,-10" VerticalAlignment="Center" HorizontalAlignment="Left" >
                    <FlipView Tapped="ModalGalleryFlipView_Tapped" Padding="0" SelectionChanged="ModalGalleryFlipView_SelectionChanged" Margin="0" Name="ModalGalleryFlipView" Grid.Row="0" Grid.RowSpan="3" Grid.ColumnSpan="3" ItemTemplate="{StaticResource GalleryMainTemplate}" /><Button Margin="10,0,0,0" Name="ModalGalleryBackButton" VerticalAlignment="Top" HorizontalAlignment="Left" BorderThickness="0" Click="ModalGalleryBackButton_Click" Padding="10,15,10,10" > <Image Stretch="None"  Source="/Assets/Left-Arrow.png"/>
                    </Button>
                </Grid>
            </GridView>
        </SemanticZoom.ZoomedInView>

我再次尝试了一个更清晰的例子

<SemanticZoom.ZoomedInView>
            <GridView Name="ZoomedInGridView" IsItemClickEnabled="False" ScrollViewer.HorizontalScrollMode="Disabled" ScrollViewer.VerticalScrollMode="Disabled" SelectionMode="None" IsHoldingEnabled="False" IsSwipeEnabled="False" CanReorderItems="False" CanDragItems="False" VerticalAlignment="Center" HorizontalAlignment="Left" Padding="0" Margin="0" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
                <GridView.ItemContainerStyle >
                    <Style TargetType="GridViewItem">
                        <Setter Property="HorizontalContentAlignment" Value="Left"/>
                    </Style>
                </GridView.ItemContainerStyle>
                <FlipView>
                <Image Height="1000" Width="1000" Stretch="UniformToFill"  Source="/Assets/Twitter.png"/>
                <Image Height="1000" Width="1000" Stretch="UniformToFill"  Source="/Assets/Facebook.png"/>
                </FlipView>
            </GridView>
        </SemanticZoom.ZoomedInView>

结果是一样的,我可以选择两个图像,我应该没有。实际上它接缝整个flipview被选中。如何阻止选择flipview?

1 个答案:

答案 0 :(得分:0)

解决方案是使用gridviewitem的costum样式,如下所示:http://blogs.u2u.be/diederik/post/2012/07/09/The-taming-of-the-Metro-GridView.aspx现在我的flipview在点击时不会进入“按下”状态