如何突出在WP8的LongListSelector选定的项目吗? [英] How to highlight a selected item in the LongListSelector on WP8?

查看:91
本文介绍了如何突出在WP8的LongListSelector选定的项目吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这怎么可能突出显示在Windows Phone 8新LongListSelector选定的项目?其实也没什么happend如果我拍了拍列表中的一个条目。我的列表只包含一个简单的字符串,将通过一个TextBlock显示。但我想强调用户的选择。

How is it possible to highlight the selected item in the new LongListSelector on Windows Phone 8? Actually nothing happend if I tapped one entry of the list. My list only contains a simple string which will be displayed through a TextBlock. But I want to highlight the selection of the user.

感谢。

推荐答案

在我来说,我使用的的DataTemplate A 单选控制在 LongListSelectorItem 来实现这一目标。你将有一个检查奥德在左边框选中标志。

In my case I used a RadioButtonControl in the DataTemplate of the LongListSelectorItem to achieve this. You will have a checked oder unchecked sign at the left border.

在任何情况下,它是很重要的,你设置的同一组的所有单选按钮,这样的选择不仅代表一个条目。

In any case it is important, that you set the same group for all Radiobuttons, so the selection only represents one entry.

内容单选你可以把的TextBlock 绑定到字符串

即时通讯目前不在家,但如果这不会解决你的问题,我会为您提供一些代码,当我在家里​​;)

Im currently not at home, but if this wont solve your problem, I'll provide you some code when I'm at home ;)

在这里你去:

<LongListSelector.ItemTemplate>
    <DataTemplate>
        <ContentControl HorizontalAlignment="Stretch" HorizontalContentAlignment="Left">
            <RadioButton HorizontalAlignment="Stretch" Margin="0,0,0,0" GroupName="A" Background="Black" >
                <StackPanel toolkit:TiltEffect.IsTiltEnabled="True">
                    <TextBlock Text="{Binding Path=XXX}" 
                               TextWrapping="Wrap"
                               Foreground="Black" 
                               Style="{StaticResource PhoneTextExtraLargeStyle}"/>
                    <TextBlock Text="{Binding Path=XXXX}" 
                               TextWrapping="Wrap" 
                               Foreground="Black" 
                               Margin="14,-6,0,0" 
                               Style="{StaticResource PhoneTextSubtleStyle}"/>
                </StackPanel>
            </RadioButton>
        </ContentControl>
    </DataTemplate>
</LongListSelector.ItemTemplate>

这篇关于如何突出在WP8的LongListSelector选定的项目吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆