首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Windows Phone 8 Panorama SelectionIndex在浏览项目时不会改变

Windows Phone 8 Panorama SelectionIndex在浏览项目时不会改变
EN

Stack Overflow用户
提问于 2014-05-06 09:47:53
回答 2查看 453关注 0票数 0

我创建了全景控件,并从ItemSource绑定了ItemSource。现在,当我通过滑动来改变所选的全景项目时,所选的索引总是设置为-1。我不知道我在执行过程中做错了什么。两个选择更改事件都不会被解雇。代码:

代码语言:javascript
复制
<phone:Panorama Grid.Row="1"  Visibility="Visible"
       x:Name="PnrVwMainNews"
       ItemsSource="{Binding ParnormaItemsData}"
       ItemContainerStyle="{StaticResource PanoramaContainerItemStyle}">
    <phone:Panorama.ItemTemplate>
        <DataTemplate>
            <!-- Panorma Items Template -->
            <Controls:DynamicContentControl Content="{Binding UsrCntrlDynamic}" />
        </DataTemplate>
    </phone:Panorama.ItemTemplate>
</phone:Panorama> 

PanoramaContainerItemStyle

代码语言:javascript
复制
<Style x:Key="PanoramaContainerItemStyle" TargetType="phone:PanoramaItem">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="phone:PanoramaItem">
                    <Grid Background="{TemplateBinding Background}" Margin="12,0,0,0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Grid.Row="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
EN

回答 2

Stack Overflow用户

发布于 2014-05-07 08:54:14

我在这里看不到任何Selection_Changed事件的实现/钩住。

代码语言:javascript
复制
SelectionChanged="Panorama_SelectionChanged"

您应该首先在全景级别上定义此事件。(不在PanoramaContainerItemStyle内)

票数 0
EN

Stack Overflow用户

发布于 2014-05-07 12:01:10

最后在SelectedItem事件处理程序中将null赋值给SelectionChanged,这样每次都会选择新的项。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23491238

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档