Windows phone 7 长列表选择器

Windows phone 7 长列表选择器,windows-phone-7,Windows Phone 7,如何为我在longlistselector中选择的项目添加突出显示效果? 还可以实现多选吗?您可能会发现WindowsPhoneGeek上的这两篇文章很有用: 您应该能够通过修改“selected”状态向所选项目添加突出显示效果。我认为LongListSelector不支持多选。在LongListSelector的默认实现中,您不能突出显示当前选定的项目。唯一可用的VisualState是: * Scrolling * NotScrolling 在“滚动状态”组中 因此,实际上默认情况

如何为我在longlistselector中选择的项目添加突出显示效果?
还可以实现多选吗?

您可能会发现WindowsPhoneGeek上的这两篇文章很有用:


您应该能够通过修改“selected”状态向所选项目添加突出显示效果。我认为
LongListSelector
不支持多选。

在LongListSelector的默认实现中,您不能突出显示当前选定的项目。唯一可用的VisualState是:

* Scrolling
* NotScrolling
在“滚动状态”组中

因此,实际上默认情况下没有“选定”状态。以下是可用状态的代码:

<VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ScrollStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="00:00:00.5"/>
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Scrolling">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="NotScrolling">
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

我找到了这个,它有我所需要的一切


是的,但是我应该在控件的哪个部分添加所选状态?似乎
LongListSelector
实际上没有提供选择的概念(可能是因为一旦选择某个对象,它就会关闭)。从外观上看,我认为您需要自定义类来实现一些可视状态,并相应地更改状态。不过,这不应该太难;
LongListSelectoritemsControl
上已经有一个
GroupSelected
事件,您可以使用该事件更改组的状态。